// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.iso;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Stack;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.lwjgl.opengl.GL20;
import se.krka.kahlua.vm.KahluaTable;
import zombie.Lua.LuaEventManager;
import zombie.Lua.LuaManager;
import zombie.ai.states.ZombieIdleState;
import zombie.audio.BaseSoundEmitter;
import zombie.characters.IsoGameCharacter;
import zombie.characters.IsoPlayer;
import zombie.characters.IsoSurvivor;
import zombie.characters.IsoZombie;
import zombie.characters.BodyDamage.BodyPart;
import zombie.characters.BodyDamage.BodyPartType;
import zombie.characters.Moodles.MoodleType;
import zombie.core.Color;
import zombie.core.Core;
import zombie.core.PerformanceSettings;
import zombie.core.Rand;
import zombie.core.SpriteRenderer;
import zombie.core.logger.ExceptionLogger;
import zombie.core.math.PZMath;
import zombie.core.network.ByteBufferWriter;
import zombie.core.opengl.RenderSettings;
import zombie.core.opengl.Shader;
import zombie.core.opengl.ShaderProgram;
import zombie.core.profiling.PerformanceProfileProbe;
import zombie.core.properties.PropertyContainer;
import zombie.core.textures.ColorInfo;
import zombie.core.textures.Texture;
import zombie.core.textures.TextureDraw;
import zombie.debug.DebugLog;
import zombie.debug.DebugOptions;
import zombie.debug.DebugType;
import zombie.erosion.ErosionData;
import zombie.erosion.categories.ErosionCategory;
import zombie.inventory.InventoryItem;
import zombie.inventory.InventoryItemFactory;
import zombie.inventory.ItemContainer;
import zombie.inventory.types.Food;
import zombie.inventory.types.HandWeapon;
import zombie.iso.SpriteDetails.IsoFlagType;
import zombie.iso.SpriteDetails.IsoObjectType;
import zombie.iso.areas.IsoBuilding;
import zombie.iso.areas.IsoRoom;
import zombie.iso.areas.NonPvpZone;
import zombie.iso.areas.SafeHouse;
import zombie.iso.areas.isoregion.IsoRegions;
import zombie.iso.areas.isoregion.regions.IWorldRegion;
import zombie.iso.areas.isoregion.regions.IsoWorldRegion;
import zombie.iso.objects.IsoBarricade;
import zombie.iso.objects.IsoBrokenGlass;
import zombie.iso.objects.IsoCarBatteryCharger;
import zombie.iso.objects.IsoCompost;
import zombie.iso.objects.IsoCurtain;
import zombie.iso.objects.IsoDeadBody;
import zombie.iso.objects.IsoDoor;
import zombie.iso.objects.IsoFire;
import zombie.iso.objects.IsoFireManager;
import zombie.iso.objects.IsoGenerator;
import zombie.iso.objects.IsoLightSwitch;
import zombie.iso.objects.IsoMannequin;
import zombie.iso.objects.IsoRainSplash;
import zombie.iso.objects.IsoRaindrop;
import zombie.iso.objects.IsoThumpable;
import zombie.iso.objects.IsoTrap;
import zombie.iso.objects.IsoTree;
import zombie.iso.objects.IsoWaveSignal;
import zombie.iso.objects.IsoWindow;
import zombie.iso.objects.IsoWindowFrame;
import zombie.iso.objects.IsoWorldInventoryObject;
import zombie.iso.objects.RainManager;
import zombie.iso.objects.interfaces.BarricadeAble;
import zombie.iso.sprite.IsoDirectionFrame;
import zombie.iso.sprite.IsoSprite;
import zombie.iso.sprite.IsoSpriteInstance;
import zombie.iso.sprite.IsoSpriteManager;
import zombie.iso.sprite.shapers.FloorShaper;
import zombie.iso.sprite.shapers.FloorShaperAttachedSprites;
import zombie.iso.sprite.shapers.FloorShaperDeDiamond;
import zombie.iso.sprite.shapers.FloorShaperDiamond;
import zombie.iso.sprite.shapers.WallShaperN;
import zombie.iso.sprite.shapers.WallShaperW;
import zombie.iso.sprite.shapers.WallShaperWhole;
import zombie.iso.weather.fx.WeatherFxMask;
import zombie.meta.Meta;
import zombie.network.GameClient;
import zombie.network.GameServer;
import zombie.network.PacketTypes;
import zombie.network.ServerLOS;
import zombie.network.ServerMap;
import zombie.network.ServerOptions;
import zombie.scripting.ScriptManager;
import zombie.scripting.objects.Item;
import zombie.util.StringUtils;
import zombie.util.Type;
import zombie.util.io.BitHeader;
import zombie.util.io.BitHeaderRead;
import zombie.util.io.BitHeaderWrite;
import zombie.util.list.PZArrayList;
import zombie.util.list.PZArrayUtil;
import zombie.vehicles.BaseVehicle;
import zombie.vehicles.PolygonalMap2;

public final class IsoGridSquare {
    private boolean hasTree;
    private ArrayList<Float> LightInfluenceB;
    private ArrayList<Float> LightInfluenceG;
    private ArrayList<Float> LightInfluenceR;
    public final IsoGridSquare[] nav = new IsoGridSquare[8];
    public int collideMatrix = -1;
    public int pathMatrix = -1;
    public int visionMatrix = -1;
    public IsoRoom room = null;
    public IsoGridSquare w;
    public IsoGridSquare nw;
    public IsoGridSquare sw;
    public IsoGridSquare s;
    public IsoGridSquare n;
    public IsoGridSquare ne;
    public IsoGridSquare se;
    public IsoGridSquare e;
    public boolean haveSheetRope = false;
    private IWorldRegion isoWorldRegion;
    private boolean hasSetIsoWorldRegion = false;
    public int ObjectsSyncCount = 0;
    public IsoBuilding roofHideBuilding;
    public boolean bFlattenGrassEtc;
    private static final long VisiFlagTimerPeriod_ms = 750L;
    private final boolean[] playerCutawayFlags = new boolean[4];
    private final long[] playerCutawayFlagLockUntilTimes = new long[4];
    private final boolean[] targetPlayerCutawayFlags = new boolean[4];
    private final boolean[] playerIsDissolvedFlags = new boolean[4];
    private final long[] playerIsDissolvedFlagLockUntilTimes = new long[4];
    private final boolean[] targetPlayerIsDissolvedFlags = new boolean[4];
    private IsoWaterGeometry water = null;
    private IsoPuddlesGeometry puddles = null;
    private float puddlesCacheSize = -1.0F;
    private float puddlesCacheLevel = -1.0F;
    public final IsoGridSquare.ILighting[] lighting = new IsoGridSquare.ILighting[4];
    public int x;
    public int y;
    public int z;
    private int CachedScreenValue = -1;
    public float CachedScreenX;
    public float CachedScreenY;
    private static long torchTimer = 0L;
    public boolean SolidFloorCached = false;
    public boolean SolidFloor = false;
    private boolean CacheIsFree = false;
    private boolean CachedIsFree = false;
    public IsoChunk chunk;
    public int roomID = -1;
    public Integer ID = -999;
    public IsoMetaGrid.Zone zone;
    private final ArrayList<IsoGameCharacter> DeferedCharacters = new ArrayList();
    private int DeferredCharacterTick = -1;
    private final ArrayList<IsoMovingObject> StaticMovingObjects = new ArrayList(0);
    private final ArrayList<IsoMovingObject> MovingObjects = new ArrayList(0);
    protected final PZArrayList<IsoObject> Objects = new PZArrayList<>(IsoObject.class, 2);
    protected final PZArrayList<IsoObject> localTemporaryObjects = new PZArrayList<>(IsoObject.class, 2);
    private final ArrayList<IsoWorldInventoryObject> WorldObjects = new ArrayList();
    final zombie.ZomboidBitFlag hasTypes = new zombie.ZomboidBitFlag(IsoObjectType.MAX.index());
    private final PropertyContainer Properties = new PropertyContainer();
    private final ArrayList<IsoObject> SpecialObjects = new ArrayList(0);
    public boolean haveRoof = false;
    private boolean burntOut = false;
    private boolean bHasFlies = false;
    private IsoGridOcclusionData OcclusionDataCache = null;
    private static final PZArrayList<IsoWorldInventoryObject> tempWorldInventoryObjects = new PZArrayList<>(IsoWorldInventoryObject.class, 16);
    public static final ConcurrentLinkedQueue<IsoGridSquare> isoGridSquareCache = new ConcurrentLinkedQueue();
    public static ArrayDeque<IsoGridSquare> loadGridSquareCache;
    private boolean overlayDone = false;
    private KahluaTable table = null;
    private int trapPositionX = -1;
    private int trapPositionY = -1;
    private int trapPositionZ = -1;
    private boolean haveElectricity = false;
    public static int gridSquareCacheEmptyTimer = 0;
    private static float darkStep = 0.06F;
    public static int RecalcLightTime = 0;
    private static int lightcache = 0;
    public static final ArrayList<IsoGridSquare> choices = new ArrayList();
    public static boolean USE_WALL_SHADER = true;
    private static final int cutawayY = 0;
    private static final int cutawayNWWidth = 66;
    private static final int cutawayNWHeight = 226;
    private static final int cutawaySEXCut = 1084;
    private static final int cutawaySEXUncut = 1212;
    private static final int cutawaySEWidth = 6;
    private static final int cutawaySEHeight = 196;
    private static final int cutawayNXFullyCut = 700;
    private static final int cutawayNXCutW = 444;
    private static final int cutawayNXUncut = 828;
    private static final int cutawayNXCutE = 956;
    private static final int cutawayWXFullyCut = 512;
    private static final int cutawayWXCutS = 768;
    private static final int cutawayWXUncut = 896;
    private static final int cutawayWXCutN = 256;
    private static final int cutawayFenceXOffset = 1;
    private static final int cutawayLogWallXOffset = 1;
    private static final int cutawayMedicalCurtainWXOffset = -3;
    private static final int cutawaySpiffoWindowXOffset = -24;
    private static final int cutawayRoof4XOffset = -60;
    private static final int cutawayRoof17XOffset = -46;
    private static final int cutawayRoof28XOffset = -60;
    private static final int cutawayRoof41XOffset = -46;
    private static final ColorInfo lightInfoTemp = new ColorInfo();
    private static final float doorWindowCutawayLightMin = 0.3F;
    private static boolean bWallCutawayW;
    private static boolean bWallCutawayN;
    public boolean isSolidFloorCache;
    public boolean isExteriorCache;
    public boolean isVegitationCache;
    public int hourLastSeen = Integer.MIN_VALUE;
    static IsoGridSquare lastLoaded = null;
    public static int IDMax = -1;
    static int col = -1;
    static int path = -1;
    static int pathdoor = -1;
    static int vision = -1;
    public long hashCodeObjects;
    static final Color tr = new Color(1, 1, 1, 1);
    static final Color tl = new Color(1, 1, 1, 1);
    static final Color br = new Color(1, 1, 1, 1);
    static final Color bl = new Color(1, 1, 1, 1);
    static final Color interp1 = new Color(1, 1, 1, 1);
    static final Color interp2 = new Color(1, 1, 1, 1);
    static final Color finalCol = new Color(1, 1, 1, 1);
    public static final IsoGridSquare.CellGetSquare cellGetSquare = new IsoGridSquare.CellGetSquare();
    public boolean propertiesDirty = true;
    public static boolean UseSlowCollision = false;
    private static boolean bDoSlowPathfinding = false;
    private static final Comparator<IsoMovingObject> comp = (isoMovingObject0, isoMovingObject1) -> isoMovingObject0.compareToY(isoMovingObject1);
    public static boolean isOnScreenLast = false;
    private float splashX;
    private float splashY;
    private float splashFrame = -1.0F;
    private int splashFrameNum;
    private final ColorInfo[] lightInfo = new ColorInfo[4];
    static String[] rainsplashCache = new String[50];
    private static final ColorInfo defColorInfo = new ColorInfo();
    private static final ColorInfo blackColorInfo = new ColorInfo();
    static int colu = 0;
    static int coll = 0;
    static int colr = 0;
    static int colu2 = 0;
    static int coll2 = 0;
    static int colr2 = 0;
    public static boolean CircleStencil = false;
    public static float rmod = 0.0F;
    public static float gmod = 0.0F;
    public static float bmod = 0.0F;
    static final Vector2 tempo = new Vector2();
    static final Vector2 tempo2 = new Vector2();
    private IsoRaindrop RainDrop = null;
    private IsoRainSplash RainSplash = null;
    private ErosionData.Square erosion;
    private static final int[] SURFACE_OFFSETS = new int[8];
    public static final int WALL_TYPE_N = 1;
    public static final int WALL_TYPE_S = 2;
    public static final int WALL_TYPE_W = 4;
    public static final int WALL_TYPE_E = 8;

    public static boolean getMatrixBit(int matrix, int _x, int _y, int _z) {
        return getMatrixBit(matrix, (byte)_x, (byte)_y, (byte)_z);
    }

    public static boolean getMatrixBit(int matrix, byte _x, byte _y, byte _z) {
        return (matrix >> _x + _y * 3 + _z * 9 & 1) != 0;
    }

    public static int setMatrixBit(int matrix, int _x, int _y, int _z, boolean val) {
        return setMatrixBit(matrix, (byte)_x, (byte)_y, (byte)_z, val);
    }

    public static int setMatrixBit(int matrix, byte _x, byte _y, byte _z, boolean val) {
        return val ? matrix | 1 << _x + _y * 3 + _z * 9 : matrix & ~(1 << _x + _y * 3 + _z * 9);
    }

    public void setPlayerCutawayFlag(int playerIndex, boolean bCutaway, long currentTimeMillis) {
        this.targetPlayerCutawayFlags[playerIndex] = bCutaway;
        if (currentTimeMillis > this.playerCutawayFlagLockUntilTimes[playerIndex]
            && this.playerCutawayFlags[playerIndex] != this.targetPlayerCutawayFlags[playerIndex]) {
            this.playerCutawayFlags[playerIndex] = this.targetPlayerCutawayFlags[playerIndex];
            this.playerCutawayFlagLockUntilTimes[playerIndex] = currentTimeMillis + 750L;
        }
    }

    public boolean getPlayerCutawayFlag(int playerIndex, long currentTimeMillis) {
        return currentTimeMillis > this.playerCutawayFlagLockUntilTimes[playerIndex]
            ? this.targetPlayerCutawayFlags[playerIndex]
            : this.playerCutawayFlags[playerIndex];
    }

    public void setIsDissolved(int playerIndex, boolean bDissolved, long currentTimeMillis) {
        this.targetPlayerIsDissolvedFlags[playerIndex] = bDissolved;
        if (currentTimeMillis > this.playerIsDissolvedFlagLockUntilTimes[playerIndex]
            && this.playerIsDissolvedFlags[playerIndex] != this.targetPlayerIsDissolvedFlags[playerIndex]) {
            this.playerIsDissolvedFlags[playerIndex] = this.targetPlayerIsDissolvedFlags[playerIndex];
            this.playerIsDissolvedFlagLockUntilTimes[playerIndex] = currentTimeMillis + 750L;
        }
    }

    public boolean getIsDissolved(int playerIndex, long currentTimeMillis) {
        return currentTimeMillis > this.playerIsDissolvedFlagLockUntilTimes[playerIndex]
            ? this.targetPlayerIsDissolvedFlags[playerIndex]
            : this.playerIsDissolvedFlags[playerIndex];
    }

    public IsoWaterGeometry getWater() {
        if (this.water != null && this.water.m_adjacentChunkLoadedCounter != this.chunk.m_adjacentChunkLoadedCounter) {
            this.water.m_adjacentChunkLoadedCounter = this.chunk.m_adjacentChunkLoadedCounter;
            if (this.water.hasWater || this.water.bShore) {
                this.clearWater();
            }
        }

        if (this.water == null) {
            try {
                this.water = IsoWaterGeometry.pool.alloc();
                this.water.m_adjacentChunkLoadedCounter = this.chunk.m_adjacentChunkLoadedCounter;
                if (this.water.init(this) == null) {
                    IsoWaterGeometry.pool.release(this.water);
                    this.water = null;
                }
            } catch (Exception exception) {
                this.clearWater();
            }
        }

        return this.water;
    }

    public void clearWater() {
        if (this.water != null) {
            IsoWaterGeometry.pool.release(this.water);
            this.water = null;
        }
    }

    public IsoPuddlesGeometry getPuddles() {
        if (this.puddles == null) {
            try {
                synchronized (IsoPuddlesGeometry.pool) {
                    this.puddles = IsoPuddlesGeometry.pool.alloc();
                }

                this.puddles.square = this;
                this.puddles.bRecalc = true;
            } catch (Exception exception) {
                this.clearPuddles();
            }
        }

        return this.puddles;
    }

    public void clearPuddles() {
        if (this.puddles != null) {
            this.puddles.square = null;
            synchronized (IsoPuddlesGeometry.pool) {
                IsoPuddlesGeometry.pool.release(this.puddles);
            }

            this.puddles = null;
        }
    }

    public float getPuddlesInGround() {
        if (this.isInARoom()) {
            return -1.0F;
        } else {
            if ((double)Math.abs(
                    IsoPuddles.getInstance().getPuddlesSize()
                        + (float)Core.getInstance().getPerfPuddles()
                        + (float)IsoCamera.frameState.OffscreenWidth
                        - this.puddlesCacheSize
                )
                > 0.01) {
                this.puddlesCacheSize = IsoPuddles.getInstance().getPuddlesSize()
                    + (float)Core.getInstance().getPerfPuddles()
                    + (float)IsoCamera.frameState.OffscreenWidth;
                this.puddlesCacheLevel = IsoPuddlesCompute.computePuddle(this);
            }

            return this.puddlesCacheLevel;
        }
    }

    public IsoGridOcclusionData getOcclusionData() {
        return this.OcclusionDataCache;
    }

    public IsoGridOcclusionData getOrCreateOcclusionData() {
        assert !GameServer.bServer;

        if (this.OcclusionDataCache == null) {
            this.OcclusionDataCache = new IsoGridOcclusionData(this);
        }

        return this.OcclusionDataCache;
    }

    public void softClear() {
        this.zone = null;
        this.room = null;
        this.w = null;
        this.nw = null;
        this.sw = null;
        this.s = null;
        this.n = null;
        this.ne = null;
        this.se = null;
        this.e = null;
        this.isoWorldRegion = null;
        this.hasSetIsoWorldRegion = false;

        for (int _int = 0; _int < 8; _int++) {
            this.nav[_int] = null;
        }
    }

    public float getGridSneakModifier(boolean onlySolidTrans) {
        if (!onlySolidTrans) {
            if (this.Properties.Is("CloseSneakBonus")) {
                return (float)Integer.parseInt(this.Properties.Val("CloseSneakBonus")) / 100.0F;
            }

            if (this.Properties.Is(IsoFlagType.collideN)
                || this.Properties.Is(IsoFlagType.collideW)
                || this.Properties.Is(IsoFlagType.WindowN)
                || this.Properties.Is(IsoFlagType.WindowW)
                || this.Properties.Is(IsoFlagType.doorN)
                || this.Properties.Is(IsoFlagType.doorW)) {
                return 8.0F;
            }
        } else if (this.Properties.Is(IsoFlagType.solidtrans)) {
            return 4.0F;
        }

        return 1.0F;
    }

    public boolean isSomethingTo(IsoGridSquare other) {
        return this.isWallTo(other) || this.isWindowTo(other) || this.isDoorTo(other);
    }

    public IsoObject getTransparentWallTo(IsoGridSquare other) {
        if (other == null || other == this || !this.isWallTo(other)) {
            return null;
        } else if (other.x > this.x && other.Properties.Is(IsoFlagType.SpearOnlyAttackThrough) && !other.Properties.Is(IsoFlagType.WindowW)) {
            return other.getWall();
        } else if (this.x > other.x && this.Properties.Is(IsoFlagType.SpearOnlyAttackThrough) && !this.Properties.Is(IsoFlagType.WindowW)) {
            return this.getWall();
        } else if (other.y > this.y && other.Properties.Is(IsoFlagType.SpearOnlyAttackThrough) && !other.Properties.Is(IsoFlagType.WindowN)) {
            return other.getWall();
        } else if (this.y > other.y && this.Properties.Is(IsoFlagType.SpearOnlyAttackThrough) && !this.Properties.Is(IsoFlagType.WindowN)) {
            return this.getWall();
        } else {
            if (other.x != this.x && other.y != this.y) {
                IsoObject isoObject0 = this.getTransparentWallTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z));
                IsoObject isoObject1 = this.getTransparentWallTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z));
                if (isoObject0 != null) {
                    return isoObject0;
                }

                if (isoObject1 != null) {
                    return isoObject1;
                }

                isoObject0 = other.getTransparentWallTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z));
                isoObject1 = other.getTransparentWallTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z));
                if (isoObject0 != null) {
                    return isoObject0;
                }

                if (isoObject1 != null) {
                    return isoObject1;
                }
            }

            return null;
        }
    }

    public boolean isWallTo(IsoGridSquare other) {
        if (other == null || other == this) {
            return false;
        } else if (other.x > this.x && other.Properties.Is(IsoFlagType.collideW) && !other.Properties.Is(IsoFlagType.WindowW)) {
            return true;
        } else if (this.x > other.x && this.Properties.Is(IsoFlagType.collideW) && !this.Properties.Is(IsoFlagType.WindowW)) {
            return true;
        } else if (other.y > this.y && other.Properties.Is(IsoFlagType.collideN) && !other.Properties.Is(IsoFlagType.WindowN)) {
            return true;
        } else if (this.y > other.y && this.Properties.Is(IsoFlagType.collideN) && !this.Properties.Is(IsoFlagType.WindowN)) {
            return true;
        } else {
            if (other.x != this.x && other.y != this.y) {
                if (this.isWallTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || this.isWallTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }

                if (other.isWallTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || other.isWallTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }
            }

            return false;
        }
    }

    public boolean isWindowTo(IsoGridSquare other) {
        if (other == null || other == this) {
            return false;
        } else if (other.x > this.x && other.Properties.Is(IsoFlagType.windowW)) {
            return true;
        } else if (this.x > other.x && this.Properties.Is(IsoFlagType.windowW)) {
            return true;
        } else if (other.y > this.y && other.Properties.Is(IsoFlagType.windowN)) {
            return true;
        } else if (this.y > other.y && this.Properties.Is(IsoFlagType.windowN)) {
            return true;
        } else {
            if (other.x != this.x && other.y != this.y) {
                if (this.isWindowTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || this.isWindowTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }

                if (other.isWindowTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || other.isWindowTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }
            }

            return false;
        }
    }

    public boolean haveDoor() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            if (this.Objects.get(_int) instanceof IsoDoor) {
                return true;
            }
        }

        return false;
    }

    public boolean hasDoorOnEdge(IsoDirections edge, boolean ignoreOpen) {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoDoor isoDoor = Type.tryCastTo((IsoObject)this.SpecialObjects.get(_int), IsoDoor.class);
            if (isoDoor != null && isoDoor.getSpriteEdge(ignoreOpen) == edge) {
                return true;
            }

            IsoThumpable isoThumpable = Type.tryCastTo((IsoObject)this.SpecialObjects.get(_int), IsoThumpable.class);
            if (isoThumpable != null && isoThumpable.getSpriteEdge(ignoreOpen) == edge) {
                return true;
            }
        }

        return false;
    }

    public boolean hasClosedDoorOnEdge(IsoDirections isoDirections) {
        boolean _boolean = false;

        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoDoor isoDoor = Type.tryCastTo((IsoObject)this.SpecialObjects.get(_int), IsoDoor.class);
            if (isoDoor != null && !isoDoor.IsOpen() && isoDoor.getSpriteEdge(_boolean) == isoDirections) {
                return true;
            }

            IsoThumpable isoThumpable = Type.tryCastTo((IsoObject)this.SpecialObjects.get(_int), IsoThumpable.class);
            if (isoThumpable != null && !isoThumpable.IsOpen() && isoThumpable.getSpriteEdge(_boolean) == isoDirections) {
                return true;
            }
        }

        return false;
    }

    public boolean hasOpenDoorOnEdge(IsoDirections isoDirections) {
        boolean _boolean = false;

        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoDoor isoDoor = Type.tryCastTo((IsoObject)this.SpecialObjects.get(_int), IsoDoor.class);
            if (isoDoor != null && isoDoor.IsOpen() && isoDoor.getSpriteEdge(_boolean) == isoDirections) {
                return true;
            }

            IsoThumpable isoThumpable = Type.tryCastTo((IsoObject)this.SpecialObjects.get(_int), IsoThumpable.class);
            if (isoThumpable != null && isoThumpable.IsOpen() && isoThumpable.getSpriteEdge(_boolean) == isoDirections) {
                return true;
            }
        }

        return false;
    }

    public boolean isDoorTo(IsoGridSquare other) {
        if (other == null || other == this) {
            return false;
        } else if (other.x > this.x && other.Properties.Is(IsoFlagType.doorW)) {
            return true;
        } else if (this.x > other.x && this.Properties.Is(IsoFlagType.doorW)) {
            return true;
        } else if (other.y > this.y && other.Properties.Is(IsoFlagType.doorN)) {
            return true;
        } else if (this.y > other.y && this.Properties.Is(IsoFlagType.doorN)) {
            return true;
        } else {
            if (other.x != this.x && other.y != this.y) {
                if (this.isDoorTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || this.isDoorTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }

                if (other.isDoorTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || other.isDoorTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }
            }

            return false;
        }
    }

    public boolean isBlockedTo(IsoGridSquare other) {
        return this.isWallTo(other) || this.isWindowBlockedTo(other) || this.isDoorBlockedTo(other);
    }

    public boolean isWindowBlockedTo(IsoGridSquare other) {
        if (other == null) {
            return false;
        } else if (other.x > this.x && other.hasBlockedWindow(false)) {
            return true;
        } else if (this.x > other.x && this.hasBlockedWindow(false)) {
            return true;
        } else if (other.y > this.y && other.hasBlockedWindow(true)) {
            return true;
        } else if (this.y > other.y && this.hasBlockedWindow(true)) {
            return true;
        } else {
            if (other.x != this.x && other.y != this.y) {
                if (this.isWindowBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || this.isWindowBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }

                if (other.isWindowBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || other.isWindowBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }
            }

            return false;
        }
    }

    public boolean hasBlockedWindow(boolean north) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject instanceof IsoWindow isoWindow && isoWindow.getNorth() == north) {
                return !isoWindow.isDestroyed() && !isoWindow.open || isoWindow.isBarricaded();
            }
        }

        return false;
    }

    public boolean isDoorBlockedTo(IsoGridSquare other) {
        if (other == null) {
            return false;
        } else if (other.x > this.x && other.hasBlockedDoor(false)) {
            return true;
        } else if (this.x > other.x && this.hasBlockedDoor(false)) {
            return true;
        } else if (other.y > this.y && other.hasBlockedDoor(true)) {
            return true;
        } else if (this.y > other.y && this.hasBlockedDoor(true)) {
            return true;
        } else {
            if (other.x != this.x && other.y != this.y) {
                if (this.isDoorBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || this.isDoorBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }

                if (other.isDoorBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(other.x, this.y, this.z))
                    || other.isDoorBlockedTo(IsoWorld.instance.CurrentCell.getGridSquare(this.x, other.y, this.z))) {
                    return true;
                }
            }

            return false;
        }
    }

    public boolean hasBlockedDoor(boolean north) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject instanceof IsoDoor isoDoor && isoDoor.getNorth() == north) {
                return !isoDoor.open || isoDoor.isBarricaded();
            }

            if (isoObject instanceof IsoThumpable isoThumpable && isoThumpable.isDoor() && isoThumpable.getNorth() == north) {
                return !isoThumpable.open || isoThumpable.isBarricaded();
            }
        }

        return false;
    }

    public IsoCurtain getCurtain(IsoObjectType curtainType) {
        for (int _int = 0; _int < this.getSpecialObjects().size(); _int++) {
            IsoCurtain isoCurtain = Type.tryCastTo((IsoObject)this.getSpecialObjects().get(_int), IsoCurtain.class);
            if (isoCurtain != null && isoCurtain.getType() == curtainType) {
                return isoCurtain;
            }
        }

        return null;
    }

    public IsoObject getHoppable(boolean north) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            PropertyContainer propertyContainer = isoObject.getProperties();
            if (propertyContainer != null && propertyContainer.Is(north ? IsoFlagType.HoppableN : IsoFlagType.HoppableW)) {
                return isoObject;
            }

            if (propertyContainer != null && propertyContainer.Is(north ? IsoFlagType.WindowN : IsoFlagType.WindowW)) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getHoppableTo(IsoGridSquare next) {
        if (next != null && next != this) {
            if (next.x < this.x && next.y == this.y) {
                IsoObject isoObject0 = this.getHoppable(false);
                if (isoObject0 != null) {
                    return isoObject0;
                }
            }

            if (next.x == this.x && next.y < this.y) {
                IsoObject isoObject1 = this.getHoppable(true);
                if (isoObject1 != null) {
                    return isoObject1;
                }
            }

            if (next.x > this.x && next.y == this.y) {
                IsoObject isoObject2 = next.getHoppable(false);
                if (isoObject2 != null) {
                    return isoObject2;
                }
            }

            if (next.x == this.x && next.y > this.y) {
                IsoObject isoObject3 = next.getHoppable(true);
                if (isoObject3 != null) {
                    return isoObject3;
                }
            }

            if (next.x != this.x && next.y != this.y) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, next.y, this.z);
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(next.x, this.y, this.z);
                IsoObject isoObject4 = this.getHoppableTo(isoGridSquare0);
                if (isoObject4 != null) {
                    return isoObject4;
                }

                isoObject4 = this.getHoppableTo(isoGridSquare1);
                if (isoObject4 != null) {
                    return isoObject4;
                }

                isoObject4 = next.getHoppableTo(isoGridSquare0);
                if (isoObject4 != null) {
                    return isoObject4;
                }

                isoObject4 = next.getHoppableTo(isoGridSquare1);
                if (isoObject4 != null) {
                    return isoObject4;
                }
            }

            return null;
        } else {
            return null;
        }
    }

    public boolean isHoppableTo(IsoGridSquare other) {
        if (other == null) {
            return false;
        } else if (other.x != this.x && other.y != this.y) {
            return false;
        } else if (other.x > this.x && other.Properties.Is(IsoFlagType.HoppableW)) {
            return true;
        } else if (this.x > other.x && this.Properties.Is(IsoFlagType.HoppableW)) {
            return true;
        } else {
            return other.y > this.y && other.Properties.Is(IsoFlagType.HoppableN) ? true : this.y > other.y && this.Properties.Is(IsoFlagType.HoppableN);
        }
    }

    public void discard() {
        this.hourLastSeen = -32768;
        this.chunk = null;
        this.zone = null;
        this.LightInfluenceB = null;
        this.LightInfluenceG = null;
        this.LightInfluenceR = null;
        this.room = null;
        this.w = null;
        this.nw = null;
        this.sw = null;
        this.s = null;
        this.n = null;
        this.ne = null;
        this.se = null;
        this.e = null;
        this.isoWorldRegion = null;
        this.hasSetIsoWorldRegion = false;
        this.nav[0] = null;
        this.nav[1] = null;
        this.nav[2] = null;
        this.nav[3] = null;
        this.nav[4] = null;
        this.nav[5] = null;
        this.nav[6] = null;
        this.nav[7] = null;

        for (int _int = 0; _int < 4; _int++) {
            if (this.lighting[_int] != null) {
                this.lighting[_int].reset();
            }
        }

        this.SolidFloorCached = false;
        this.SolidFloor = false;
        this.CacheIsFree = false;
        this.CachedIsFree = false;
        this.chunk = null;
        this.roomID = -1;
        this.DeferedCharacters.clear();
        this.DeferredCharacterTick = -1;
        this.StaticMovingObjects.clear();
        this.MovingObjects.clear();
        this.Objects.clear();
        this.WorldObjects.clear();
        this.hasTypes.clear();
        this.table = null;
        this.Properties.Clear();
        this.SpecialObjects.clear();
        this.RainDrop = null;
        this.RainSplash = null;
        this.overlayDone = false;
        this.haveRoof = false;
        this.burntOut = false;
        this.trapPositionX = this.trapPositionY = this.trapPositionZ = -1;
        this.haveElectricity = false;
        this.haveSheetRope = false;
        if (this.erosion != null) {
            this.erosion.reset();
        }

        if (this.OcclusionDataCache != null) {
            this.OcclusionDataCache.Reset();
        }

        this.roofHideBuilding = null;
        this.bHasFlies = false;
        isoGridSquareCache.add(this);
    }

    private static boolean validateUser(String string1, String string0) throws MalformedURLException, IOException {
        URL uRL = new URL("http://www.projectzomboid.com/scripts/auth.php?username=" + string1 + "&password=" + string0);
        URLConnection uRLConnection = uRL.openConnection();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(uRLConnection.getInputStream()));

        String string2;
        while ((string2 = bufferedReader.readLine()) != null) {
            if (string2.contains("success")) {
                return true;
            }
        }

        return false;
    }

    public float DistTo(int _x, int _y) {
        return IsoUtils.DistanceManhatten((float)_x + 0.5F, (float)_y + 0.5F, (float)this.x, (float)this.y);
    }

    public float DistTo(IsoGridSquare sq) {
        return IsoUtils.DistanceManhatten((float)this.x + 0.5F, (float)this.y + 0.5F, (float)sq.x + 0.5F, (float)sq.y + 0.5F);
    }

    public float DistToProper(IsoGridSquare sq) {
        return IsoUtils.DistanceTo((float)this.x + 0.5F, (float)this.y + 0.5F, (float)sq.x + 0.5F, (float)sq.y + 0.5F);
    }

    public float DistTo(IsoMovingObject other) {
        return IsoUtils.DistanceManhatten((float)this.x + 0.5F, (float)this.y + 0.5F, other.getX(), other.getY());
    }

    public float DistToProper(IsoMovingObject other) {
        return IsoUtils.DistanceTo((float)this.x + 0.5F, (float)this.y + 0.5F, other.getX(), other.getY());
    }

    public boolean isSafeToSpawn() {
        choices.clear();
        this.isSafeToSpawn(this, 0);
        if (choices.size() > 7) {
            choices.clear();
            return true;
        } else {
            choices.clear();
            return false;
        }
    }

    public void isSafeToSpawn(IsoGridSquare sq, int depth) {
        if (depth <= 5) {
            choices.add(sq);
            if (sq.n != null && !choices.contains(sq.n)) {
                this.isSafeToSpawn(sq.n, depth + 1);
            }

            if (sq.s != null && !choices.contains(sq.s)) {
                this.isSafeToSpawn(sq.s, depth + 1);
            }

            if (sq.e != null && !choices.contains(sq.e)) {
                this.isSafeToSpawn(sq.e, depth + 1);
            }

            if (sq.w != null && !choices.contains(sq.w)) {
                this.isSafeToSpawn(sq.w, depth + 1);
            }
        }
    }

    public static boolean auth(String string0, char[] _char) {
        if (string0.length() > 64) {
            return false;
        } else {
            String string1 = _char.toString();
            if (string1.length() > 64) {
                return false;
            } else {
                try {
                    return validateUser(string0, string1);
                } catch (MalformedURLException malformedURLException) {
                    Logger.getLogger(IsoGridSquare.class.getName()).log(Level.SEVERE, null, malformedURLException);
                } catch (IOException iOException) {
                    Logger.getLogger(IsoGridSquare.class.getName()).log(Level.SEVERE, null, iOException);
                }

                return false;
            }
        }
    }

    private void renderAttachedSpritesWithNoWallLighting(IsoObject isoObject, ColorInfo colorInfo) {
        if (isoObject.AttachedAnimSprite != null && !isoObject.AttachedAnimSprite.isEmpty()) {
            boolean _boolean = false;

            for (int int0 = 0; int0 < isoObject.AttachedAnimSprite.size(); int0++) {
                IsoSpriteInstance isoSpriteInstance0 = (IsoSpriteInstance)isoObject.AttachedAnimSprite.get(int0);
                if (isoSpriteInstance0.parentSprite != null && isoSpriteInstance0.parentSprite.Properties.Is(IsoFlagType.NoWallLighting)) {
                    _boolean = true;
                    break;
                }
            }

            if (_boolean) {
                defColorInfo.r = colorInfo.r;
                defColorInfo.g = colorInfo.g;
                defColorInfo.b = colorInfo.b;
                float _float = defColorInfo.a;
                if (CircleStencil) {
                }

                for (int int1 = 0; int1 < isoObject.AttachedAnimSprite.size(); int1++) {
                    IsoSpriteInstance isoSpriteInstance1 = (IsoSpriteInstance)isoObject.AttachedAnimSprite.get(int1);
                    if (isoSpriteInstance1.parentSprite != null && isoSpriteInstance1.parentSprite.Properties.Is(IsoFlagType.NoWallLighting)) {
                        defColorInfo.a = isoSpriteInstance1.alpha;
                        isoSpriteInstance1.render(
                            isoObject,
                            (float)this.x,
                            (float)this.y,
                            (float)this.z,
                            isoObject.dir,
                            isoObject.offsetX,
                            isoObject.offsetY + isoObject.getRenderYOffset() * (float)Core.TileScale,
                            defColorInfo
                        );
                        isoSpriteInstance1.update();
                    }
                }

                defColorInfo.r = 1.0F;
                defColorInfo.g = 1.0F;
                defColorInfo.b = 1.0F;
                defColorInfo.a = _float;
            }
        }
    }

    public void DoCutawayShader(
        IsoObject obj,
        IsoDirections dir,
        boolean cutawaySW,
        boolean cutawayNW,
        boolean cutawayNE,
        boolean bHasDoorN,
        boolean bHasDoorW,
        boolean bHasWindowN,
        boolean bHasWindowW,
        WallShaperWhole texdModifier
    ) {
        Texture texture0 = Texture.getSharedTexture("media/wallcutaways.png");
        if (texture0 != null && texture0.getID() != -1) {
            boolean _boolean = obj.sprite.getProperties().Is(IsoFlagType.NoWallLighting);
            int int0 = IsoCamera.frameState.playerIndex;
            ColorInfo colorInfo = this.lightInfo[int0];
            int int1 = 2 / Core.TileScale;

            try {
                Texture texture1 = obj.getCurrentFrameTex();
                float float0 = 0.0F;
                float float1 = obj.getCurrentFrameTex().getOffsetY();
                int int2 = 0;
                int int3 = 226 - texture1.getHeight() * int1;
                if (dir != IsoDirections.NW) {
                    int2 = 66 - texture1.getWidth() * int1;
                }

                if (obj.sprite.getProperties().Is(IsoFlagType.WallSE)) {
                    int2 = 6 - texture1.getWidth() * int1;
                    int3 = 196 - texture1.getHeight() * int1;
                }

                if (obj.sprite.name.contains("fencing_01_11")) {
                    float0 = 1.0F;
                } else if (obj.sprite.name.contains("carpentry_02_80")) {
                    float0 = 1.0F;
                } else if (obj.sprite.name.contains("spiffos_01_71")) {
                    float0 = -24.0F;
                } else if (obj.sprite.name.contains("location_community_medical")) {
                    String string0 = obj.sprite.name.replaceAll("(.*)_", "");
                    int int4 = Integer.parseInt(string0);
                    switch (int4) {
                        case 45:
                        case 46:
                        case 47:
                        case 147:
                        case 148:
                        case 149:
                            float0 = -3.0F;
                    }
                } else if (obj.sprite.name.contains("walls_exterior_roofs")) {
                    String string1 = obj.sprite.name.replaceAll("(.*)_", "");
                    int int5 = Integer.parseInt(string1);
                    if (int5 == 4) {
                        float0 = -60.0F;
                    } else if (int5 == 17) {
                        float0 = -46.0F;
                    } else if (int5 == 28 && !obj.sprite.name.contains("03")) {
                        float0 = -60.0F;
                    } else if (int5 == 41) {
                        float0 = -46.0F;
                    }
                }

                IsoGridSquare.CircleStencilShader circleStencilShader = IsoGridSquare.CircleStencilShader.instance;
                if (dir == IsoDirections.N || dir == IsoDirections.NW) {
                    short short0 = 700;
                    short short1 = 1084;
                    if (cutawayNW) {
                        short1 = 1212;
                        if (!cutawayNE) {
                            short0 = 444;
                        }
                    } else if (!cutawayNE) {
                        short0 = 828;
                    } else {
                        short0 = 956;
                    }

                    short short2 = 0;
                    if (bHasDoorN) {
                        short2 = 904;
                        if (obj.sprite.name.contains("garage") || obj.sprite.name.contains("industry_trucks")) {
                            int int6 = obj.sprite.tileSheetIndex;
                            if (int6 % 8 == 5) {
                                short2 = 1356;
                            } else if (int6 % 8 == 4) {
                                short2 = 1582;
                            } else if (int6 % 8 == 3) {
                                short2 = 1130;
                            }
                        }

                        if (obj.sprite.name.contains("community_church")) {
                            int int7 = obj.sprite.tileSheetIndex;
                            if (int7 == 19) {
                                short2 = 1356;
                            } else if (int7 == 18) {
                                short2 = 1130;
                            }
                        }
                    } else if (bHasWindowN) {
                        short2 = 226;
                        if (obj.sprite.name.contains("trailer")) {
                            int int8 = obj.sprite.tileSheetIndex;
                            if (int8 == 14 || int8 == 38) {
                                short2 = 678;
                            } else if (int8 == 15 || int8 == 39) {
                                short2 = 452;
                            }
                        }

                        if (obj.sprite.name.contains("sunstarmotel")) {
                            int int9 = obj.sprite.tileSheetIndex;
                            if (int9 == 22 || int9 == 18) {
                                short2 = 678;
                            } else if (int9 == 23 || int9 == 19) {
                                short2 = 452;
                            }
                        }
                    }

                    colu = this.getVertLight(0, int0);
                    coll = this.getVertLight(1, int0);
                    colu2 = this.getVertLight(4, int0);
                    coll2 = this.getVertLight(5, int0);
                    if (Core.bDebug && DebugOptions.instance.DebugDraw_SkipWorldShading.getValue()) {
                        coll2 = -1;
                        colu2 = -1;
                        coll = -1;
                        colu = -1;
                        colorInfo = defColorInfo;
                    }

                    if (obj.sprite.getProperties().Is(IsoFlagType.WallSE)) {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short1 + (int)float0, short2 + (int)float1, 6 - int2, 196 - int3);
                    } else {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short0 + (int)float0, short2 + (int)float1, 66 - int2, 226 - int3);
                    }

                    if (dir == IsoDirections.N) {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.All);
                    } else {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.RightOnly);
                    }

                    texdModifier.col[0] = colu2;
                    texdModifier.col[1] = coll2;
                    texdModifier.col[2] = coll;
                    texdModifier.col[3] = colu;
                    obj.renderWallTileOnly((float)this.x, (float)this.y, (float)this.z, _boolean ? colorInfo : defColorInfo, circleStencilShader, texdModifier);
                }

                if (dir == IsoDirections.W || dir == IsoDirections.NW) {
                    short short3 = 512;
                    short short4 = 1084;
                    if (cutawaySW) {
                        if (!cutawayNW) {
                            short3 = 768;
                            short4 = 1212;
                        }
                    } else if (!cutawayNW) {
                        short3 = 896;
                        short4 = 1212;
                    } else {
                        short3 = 256;
                    }

                    short short5 = 0;
                    if (bHasDoorW) {
                        short5 = 904;
                        if (obj.sprite.name.contains("garage") || obj.sprite.name.contains("industry_trucks")) {
                            int int10 = obj.sprite.tileSheetIndex;
                            if (int10 % 8 == 0) {
                                short5 = 1356;
                            } else if (int10 % 8 == 1) {
                                short5 = 1582;
                            } else if (int10 % 8 == 2) {
                                short5 = 1130;
                            }
                        }

                        if (obj.sprite.name.contains("community_church")) {
                            int int11 = obj.sprite.tileSheetIndex;
                            if (int11 == 16) {
                                short5 = 1356;
                            } else if (int11 == 17) {
                                short5 = 1130;
                            }
                        }
                    } else if (bHasWindowW) {
                        short5 = 226;
                        if (obj.sprite.name.contains("trailer")) {
                            int int12 = obj.sprite.tileSheetIndex;
                            if (int12 == 13 || int12 == 37) {
                                short5 = 678;
                            } else if (int12 == 12 || int12 == 36) {
                                short5 = 452;
                            }
                        }

                        if (obj.sprite.name.contains("sunstarmotel")) {
                            int int13 = obj.sprite.tileSheetIndex;
                            if (int13 == 17) {
                                short5 = 678;
                            } else if (int13 == 16) {
                                short5 = 452;
                            }
                        }
                    }

                    colu = this.getVertLight(0, int0);
                    coll = this.getVertLight(3, int0);
                    colu2 = this.getVertLight(4, int0);
                    coll2 = this.getVertLight(7, int0);
                    if (Core.bDebug && DebugOptions.instance.DebugDraw_SkipWorldShading.getValue()) {
                        coll2 = -1;
                        colu2 = -1;
                        coll = -1;
                        colu = -1;
                        colorInfo = defColorInfo;
                    }

                    if (obj.sprite.getProperties().Is(IsoFlagType.WallSE)) {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short4 + (int)float0, short5 + (int)float1, 6 - int2, 196 - int3);
                    } else {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short3 + (int)float0, short5 + (int)float1, 66 - int2, 226 - int3);
                    }

                    if (dir == IsoDirections.W) {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.All);
                    } else {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.LeftOnly);
                    }

                    texdModifier.col[0] = coll2;
                    texdModifier.col[1] = colu2;
                    texdModifier.col[2] = colu;
                    texdModifier.col[3] = coll;
                    obj.renderWallTileOnly((float)this.x, (float)this.y, (float)this.z, _boolean ? colorInfo : defColorInfo, circleStencilShader, texdModifier);
                }
            } finally {
                SpriteRenderer.instance.setExtraWallShaderParams(null);
                SpriteRenderer.instance.clearCutawayTexture();
                SpriteRenderer.instance.clearUseVertColorsArray();
            }

            obj.renderAttachedAndOverlaySprites(
                (float)this.x, (float)this.y, (float)this.z, _boolean ? colorInfo : defColorInfo, false, !_boolean, null, texdModifier
            );
        }
    }

    public void DoCutawayShaderSprite(IsoSprite sprite, IsoDirections dir, boolean cutawaySW, boolean cutawayNW, boolean cutawayNE) {
        IsoGridSquare.CircleStencilShader circleStencilShader = IsoGridSquare.CircleStencilShader.instance;
        WallShaperWhole wallShaperWhole = WallShaperWhole.instance;
        int int0 = IsoCamera.frameState.playerIndex;
        Texture texture0 = Texture.getSharedTexture("media/wallcutaways.png");
        if (texture0 != null && texture0.getID() != -1) {
            int int1 = 2 / Core.TileScale;

            try {
                Texture texture1 = ((IsoDirectionFrame)sprite.CurrentAnim.Frames.get((int)sprite.def.Frame)).getTexture(dir);
                float float0 = 0.0F;
                float float1 = texture1.getOffsetY();
                int int2 = 0;
                int int3 = 226 - texture1.getHeight() * int1;
                if (dir != IsoDirections.NW) {
                    int2 = 66 - texture1.getWidth() * int1;
                }

                if (sprite.getProperties().Is(IsoFlagType.WallSE)) {
                    int2 = 6 - texture1.getWidth() * int1;
                    int3 = 196 - texture1.getHeight() * int1;
                }

                if (sprite.name.contains("fencing_01_11")) {
                    float0 = 1.0F;
                } else if (sprite.name.contains("carpentry_02_80")) {
                    float0 = 1.0F;
                } else if (sprite.name.contains("spiffos_01_71")) {
                    float0 = -24.0F;
                } else if (sprite.name.contains("location_community_medical")) {
                    String string0 = sprite.name.replaceAll("(.*)_", "");
                    int int4 = Integer.parseInt(string0);
                    switch (int4) {
                        case 45:
                        case 46:
                        case 47:
                        case 147:
                        case 148:
                        case 149:
                            float0 = -3.0F;
                    }
                } else if (sprite.name.contains("walls_exterior_roofs")) {
                    String string1 = sprite.name.replaceAll("(.*)_", "");
                    int int5 = Integer.parseInt(string1);
                    if (int5 == 4) {
                        float0 = -60.0F;
                    } else if (int5 == 17) {
                        float0 = -46.0F;
                    } else if (int5 == 28 && !sprite.name.contains("03")) {
                        float0 = -60.0F;
                    } else if (int5 == 41) {
                        float0 = -46.0F;
                    }
                }

                if (dir == IsoDirections.N || dir == IsoDirections.NW) {
                    short short0 = 700;
                    short short1 = 1084;
                    if (cutawayNW) {
                        short1 = 1212;
                        if (!cutawayNE) {
                            short0 = 444;
                        }
                    } else if (!cutawayNE) {
                        short0 = 828;
                    } else {
                        short0 = 956;
                    }

                    colu = this.getVertLight(0, int0);
                    coll = this.getVertLight(1, int0);
                    colu2 = this.getVertLight(4, int0);
                    coll2 = this.getVertLight(5, int0);
                    if (sprite.getProperties().Is(IsoFlagType.WallSE)) {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short1 + (int)float0, 0 + (int)float1, 6 - int2, 196 - int3);
                    } else {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short0 + (int)float0, 0 + (int)float1, 66 - int2, 226 - int3);
                    }

                    if (dir == IsoDirections.N) {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.All);
                    } else {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.RightOnly);
                    }

                    wallShaperWhole.col[0] = colu2;
                    wallShaperWhole.col[1] = coll2;
                    wallShaperWhole.col[2] = coll;
                    wallShaperWhole.col[3] = colu;
                    zombie.IndieGL.bindShader(
                        circleStencilShader,
                        sprite,
                        dir,
                        wallShaperWhole,
                        (isoSprite, isoDirections, wallShaperWholex) -> isoSprite.render(
                                null,
                                (float)this.x,
                                (float)this.y,
                                (float)this.z,
                                isoDirections,
                                WeatherFxMask.offsetX,
                                WeatherFxMask.offsetY,
                                defColorInfo,
                                false,
                                wallShaperWholex
                            )
                    );
                }

                if (dir == IsoDirections.W || dir == IsoDirections.NW) {
                    short short2 = 512;
                    short short3 = 1084;
                    if (cutawaySW) {
                        if (!cutawayNW) {
                            short2 = 768;
                            short3 = 1212;
                        }
                    } else if (!cutawayNW) {
                        short2 = 896;
                        short3 = 1212;
                    } else {
                        short2 = 256;
                    }

                    colu = this.getVertLight(0, int0);
                    coll = this.getVertLight(3, int0);
                    colu2 = this.getVertLight(4, int0);
                    coll2 = this.getVertLight(7, int0);
                    if (sprite.getProperties().Is(IsoFlagType.WallSE)) {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short3 + (int)float0, 0 + (int)float1, 6 - int2, 196 - int3);
                    } else {
                        SpriteRenderer.instance.setCutawayTexture(texture0, short2 + (int)float0, 0 + (int)float1, 66 - int2, 226 - int3);
                    }

                    if (dir == IsoDirections.W) {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.All);
                    } else {
                        SpriteRenderer.instance.setExtraWallShaderParams(SpriteRenderer.WallShaderTexRender.LeftOnly);
                    }

                    wallShaperWhole.col[0] = coll2;
                    wallShaperWhole.col[1] = colu2;
                    wallShaperWhole.col[2] = colu;
                    wallShaperWhole.col[3] = coll;
                    zombie.IndieGL.bindShader(
                        circleStencilShader,
                        sprite,
                        dir,
                        wallShaperWhole,
                        (isoSprite, isoDirections, wallShaperWholex) -> isoSprite.render(
                                null,
                                (float)this.x,
                                (float)this.y,
                                (float)this.z,
                                isoDirections,
                                WeatherFxMask.offsetX,
                                WeatherFxMask.offsetY,
                                defColorInfo,
                                false,
                                wallShaperWholex
                            )
                    );
                }
            } finally {
                SpriteRenderer.instance.setExtraWallShaderParams(null);
                SpriteRenderer.instance.clearCutawayTexture();
                SpriteRenderer.instance.clearUseVertColorsArray();
            }
        }
    }

    public int DoWallLightingNW(
        IsoObject obj,
        int stenciled,
        boolean cutawaySW,
        boolean cutawayNW,
        boolean cutawayNE,
        boolean bHasDoorN,
        boolean bHasDoorW,
        boolean bHasWindowN,
        boolean bHasWindowW,
        Shader wallRenderShader
    ) {
        if (!DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.NW.getValue()) {
            return stenciled;
        } else {
            boolean boolean0 = cutawaySW || cutawayNW || cutawayNE;
            IsoDirections isoDirections = IsoDirections.NW;
            int _int = IsoCamera.frameState.playerIndex;
            colu = this.getVertLight(0, _int);
            coll = this.getVertLight(3, _int);
            colr = this.getVertLight(1, _int);
            colu2 = this.getVertLight(4, _int);
            coll2 = this.getVertLight(7, _int);
            colr2 = this.getVertLight(5, _int);
            if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.LightingDebug.getValue()) {
                colu = -65536;
                coll = -16711936;
                colr = -16711681;
                colu2 = -16776961;
                coll2 = -65281;
                colr2 = -256;
            }

            boolean boolean1 = CircleStencil;
            if (this.z != (int)IsoCamera.CamCharacter.z) {
                boolean1 = false;
            }

            boolean boolean2 = obj.sprite.getType() == IsoObjectType.doorFrN || obj.sprite.getType() == IsoObjectType.doorN;
            boolean boolean3 = obj.sprite.getType() == IsoObjectType.doorFrW || obj.sprite.getType() == IsoObjectType.doorW;
            boolean boolean4 = false;
            boolean boolean5 = false;
            boolean boolean6 = (boolean2 || boolean4 || boolean3 || boolean4) && boolean0 || obj.sprite.getProperties().Is(IsoFlagType.NoWallLighting);
            boolean1 = this.calculateWallAlphaAndCircleStencilCorner(
                obj, cutawaySW, cutawayNW, cutawayNE, bHasDoorN, bHasDoorW, bHasWindowN, bHasWindowW, boolean1, _int, boolean2, boolean3, boolean4, boolean5
            );
            if (USE_WALL_SHADER && boolean1 && boolean0) {
                this.DoCutawayShader(
                    obj, isoDirections, cutawaySW, cutawayNW, cutawayNE, bHasDoorN, bHasDoorW, bHasWindowN, bHasWindowW, WallShaperWhole.instance
                );
                bWallCutawayN = true;
                bWallCutawayW = true;
                return stenciled;
            } else {
                WallShaperWhole.instance.col[0] = colu2;
                WallShaperWhole.instance.col[1] = colr2;
                WallShaperWhole.instance.col[2] = colr;
                WallShaperWhole.instance.col[3] = colu;
                WallShaperN wallShaperN = WallShaperN.instance;
                wallShaperN.col[0] = colu2;
                wallShaperN.col[1] = colr2;
                wallShaperN.col[2] = colr;
                wallShaperN.col[3] = colu;
                stenciled = this.performDrawWall(obj, stenciled, _int, boolean6, wallShaperN, wallRenderShader);
                WallShaperWhole.instance.col[0] = coll2;
                WallShaperWhole.instance.col[1] = colu2;
                WallShaperWhole.instance.col[2] = colu;
                WallShaperWhole.instance.col[3] = coll;
                WallShaperW wallShaperW = WallShaperW.instance;
                wallShaperW.col[0] = coll2;
                wallShaperW.col[1] = colu2;
                wallShaperW.col[2] = colu;
                wallShaperW.col[3] = coll;
                return this.performDrawWall(obj, stenciled, _int, boolean6, wallShaperW, wallRenderShader);
            }
        }
    }

    public int DoWallLightingN(
        IsoObject obj, int stenciled, boolean cutawayNW, boolean cutawayNE, boolean bHasDoorN, boolean bHasWindowN, Shader wallRenderShader
    ) {
        if (!DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.N.getValue()) {
            return stenciled;
        } else {
            boolean boolean0 = !bHasDoorN;
            boolean boolean1 = !bHasWindowN;
            IsoObjectType isoObjectType0 = IsoObjectType.doorFrN;
            IsoObjectType isoObjectType1 = IsoObjectType.doorN;
            boolean boolean2 = cutawayNW || cutawayNE;
            IsoFlagType isoFlagType0 = IsoFlagType.transparentN;
            IsoFlagType isoFlagType1 = IsoFlagType.WindowN;
            IsoFlagType isoFlagType2 = IsoFlagType.HoppableN;
            IsoDirections isoDirections = IsoDirections.N;
            boolean boolean3 = CircleStencil;
            int _int = IsoCamera.frameState.playerIndex;
            colu = this.getVertLight(0, _int);
            coll = this.getVertLight(1, _int);
            colu2 = this.getVertLight(4, _int);
            coll2 = this.getVertLight(5, _int);
            if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.LightingDebug.getValue()) {
                colu = -65536;
                coll = -16711936;
                colu2 = -16776961;
                coll2 = -65281;
            }

            WallShaperWhole wallShaperWhole = WallShaperWhole.instance;
            wallShaperWhole.col[0] = colu2;
            wallShaperWhole.col[1] = coll2;
            wallShaperWhole.col[2] = coll;
            wallShaperWhole.col[3] = colu;
            return this.performDrawWallSegmentSingle(
                obj,
                stenciled,
                false,
                cutawayNW,
                false,
                false,
                cutawayNE,
                bHasDoorN,
                bHasWindowN,
                boolean0,
                boolean1,
                isoObjectType0,
                isoObjectType1,
                boolean2,
                isoFlagType0,
                isoFlagType1,
                isoFlagType2,
                isoDirections,
                boolean3,
                wallShaperWhole,
                wallRenderShader
            );
        }
    }

    public int DoWallLightingW(
        IsoObject obj, int stenciled, boolean cutawaySW, boolean cutawayNW, boolean bHasDoorW, boolean bHasWindowW, Shader wallRenderShader
    ) {
        if (!DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.W.getValue()) {
            return stenciled;
        } else {
            boolean boolean0 = !bHasDoorW;
            boolean boolean1 = !bHasWindowW;
            IsoObjectType isoObjectType0 = IsoObjectType.doorFrW;
            IsoObjectType isoObjectType1 = IsoObjectType.doorW;
            boolean boolean2 = cutawaySW || cutawayNW;
            IsoFlagType isoFlagType0 = IsoFlagType.transparentW;
            IsoFlagType isoFlagType1 = IsoFlagType.WindowW;
            IsoFlagType isoFlagType2 = IsoFlagType.HoppableW;
            IsoDirections isoDirections = IsoDirections.W;
            boolean boolean3 = CircleStencil;
            int _int = IsoCamera.frameState.playerIndex;
            colu = this.getVertLight(0, _int);
            coll = this.getVertLight(3, _int);
            colu2 = this.getVertLight(4, _int);
            coll2 = this.getVertLight(7, _int);
            if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.LightingDebug.getValue()) {
                colu = -65536;
                coll = -16711936;
                colu2 = -16776961;
                coll2 = -65281;
            }

            WallShaperWhole wallShaperWhole = WallShaperWhole.instance;
            wallShaperWhole.col[0] = coll2;
            wallShaperWhole.col[1] = colu2;
            wallShaperWhole.col[2] = colu;
            wallShaperWhole.col[3] = coll;
            return this.performDrawWallSegmentSingle(
                obj,
                stenciled,
                cutawaySW,
                cutawayNW,
                bHasDoorW,
                bHasWindowW,
                false,
                false,
                false,
                boolean0,
                boolean1,
                isoObjectType0,
                isoObjectType1,
                boolean2,
                isoFlagType0,
                isoFlagType1,
                isoFlagType2,
                isoDirections,
                boolean3,
                wallShaperWhole,
                wallRenderShader
            );
        }
    }

    private int performDrawWallSegmentSingle(
        IsoObject isoObject,
        int int1,
        boolean boolean7,
        boolean boolean8,
        boolean boolean11,
        boolean boolean13,
        boolean boolean9,
        boolean boolean10,
        boolean boolean12,
        boolean boolean5,
        boolean boolean6,
        IsoObjectType isoObjectType1,
        IsoObjectType isoObjectType0,
        boolean boolean4,
        IsoFlagType isoFlagType0,
        IsoFlagType isoFlagType1,
        IsoFlagType isoFlagType2,
        IsoDirections isoDirections,
        boolean boolean0,
        WallShaperWhole wallShaperWhole,
        Shader shader
    ) {
        int int0 = IsoCamera.frameState.playerIndex;
        if (this.z != (int)IsoCamera.CamCharacter.z) {
            boolean0 = false;
        }

        boolean boolean1 = isoObject.sprite.getType() == isoObjectType1 || isoObject.sprite.getType() == isoObjectType0;
        boolean boolean2 = isoObject instanceof IsoWindow;
        boolean boolean3 = (boolean1 || boolean2) && boolean4 || isoObject.sprite.getProperties().Is(IsoFlagType.NoWallLighting);
        boolean0 = this.calculateWallAlphaAndCircleStencilEdge(
            isoObject, boolean5, boolean6, boolean4, isoFlagType0, isoFlagType1, isoFlagType2, boolean0, int0, boolean1, boolean2
        );
        if (USE_WALL_SHADER && boolean0 && boolean4) {
            this.DoCutawayShader(isoObject, isoDirections, boolean7, boolean8, boolean9, boolean10, boolean11, boolean12, boolean13, wallShaperWhole);
            bWallCutawayN = bWallCutawayN | isoDirections == IsoDirections.N;
            bWallCutawayW = bWallCutawayW | isoDirections == IsoDirections.W;
            return int1;
        } else {
            return this.performDrawWall(isoObject, int1, int0, boolean3, wallShaperWhole, shader);
        }
    }

    private int performDrawWallOnly(IsoObject isoObject, int int0, int int1, boolean _boolean, Consumer<TextureDraw> consumer, Shader shader) {
        if (int0 == 0 && !_boolean) {
            int0 = this.getCell().getStencilValue(this.x, this.y, this.z);
        }

        zombie.IndieGL.enableAlphaTest();
        zombie.IndieGL.glAlphaFunc(516, 0.0F);
        zombie.IndieGL.glStencilFunc(519, int0, 127);
        if (!_boolean) {
            zombie.IndieGL.glStencilOp(7680, 7680, 7681);
        }

        if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.Render.getValue()) {
            isoObject.renderWallTile((float)this.x, (float)this.y, (float)this.z, _boolean ? lightInfoTemp : defColorInfo, true, !_boolean, shader, consumer);
        }

        isoObject.setAlpha(int1, 1.0F);
        if (_boolean) {
            zombie.IndieGL.glStencilFunc(519, 1, 255);
            zombie.IndieGL.glStencilOp(7680, 7680, 7680);
            return int0;
        } else {
            this.getCell().setStencilValue(this.x, this.y, this.z, int0);
            return int0 + 1;
        }
    }

    private int performDrawWall(IsoObject isoObject, int int1, int int0, boolean _boolean, Consumer<TextureDraw> consumer, Shader shader) {
        lightInfoTemp.set(this.lightInfo[int0]);
        if (Core.bDebug && DebugOptions.instance.DebugDraw_SkipWorldShading.getValue()) {
            isoObject.render((float)this.x, (float)this.y, (float)this.z, defColorInfo, true, !_boolean, null);
            return int1;
        } else {
            int int2 = this.performDrawWallOnly(isoObject, int1, int0, _boolean, consumer, shader);
            if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Walls.AttachedSprites.getValue()) {
                this.renderAttachedSpritesWithNoWallLighting(isoObject, lightInfoTemp);
            }

            return int2;
        }
    }

    private void calculateWallAlphaCommon(
        IsoObject isoObject, boolean boolean2, boolean boolean3, boolean boolean4, int _int, boolean boolean0, boolean boolean1
    ) {
        if (boolean0 || boolean1) {
            if (boolean2) {
                isoObject.setAlpha(_int, 0.4F);
                isoObject.setTargetAlpha(_int, 0.4F);
                lightInfoTemp.r = Math.max(0.3F, lightInfoTemp.r);
                lightInfoTemp.g = Math.max(0.3F, lightInfoTemp.g);
                lightInfoTemp.b = Math.max(0.3F, lightInfoTemp.b);
                if (boolean0 && !boolean3) {
                    isoObject.setAlpha(_int, 0.0F);
                    isoObject.setTargetAlpha(_int, 0.0F);
                }

                if (boolean1 && !boolean4) {
                    isoObject.setAlpha(_int, 0.0F);
                    isoObject.setTargetAlpha(_int, 0.0F);
                }
            }
        }
    }

    private boolean calculateWallAlphaAndCircleStencilEdge(
        IsoObject isoObject,
        boolean boolean5,
        boolean boolean4,
        boolean boolean3,
        IsoFlagType isoFlagType1,
        IsoFlagType isoFlagType0,
        IsoFlagType var7,
        boolean boolean2,
        int _int,
        boolean boolean0,
        boolean boolean1
    ) {
        if (boolean0 || boolean1) {
            if (!isoObject.sprite.getProperties().Is("GarageDoor")) {
                boolean2 = false;
            }

            this.calculateWallAlphaCommon(isoObject, boolean3, !boolean5, !boolean4, _int, boolean0, boolean1);
        }

        if (boolean2
            && isoObject.sprite.getType() == IsoObjectType.wall
            && isoObject.sprite.getProperties().Is(isoFlagType1)
            && !isoObject.getSprite().getProperties().Is(IsoFlagType.exterior)
            && !isoObject.sprite.getProperties().Is(isoFlagType0)) {
            boolean2 = false;
        }

        return boolean2;
    }

    private boolean calculateWallAlphaAndCircleStencilCorner(
        IsoObject isoObject,
        boolean boolean10,
        boolean boolean4,
        boolean boolean5,
        boolean boolean0,
        boolean boolean6,
        boolean boolean1,
        boolean boolean7,
        boolean boolean11,
        int _int,
        boolean boolean2,
        boolean boolean8,
        boolean boolean3,
        boolean boolean9
    ) {
        this.calculateWallAlphaCommon(isoObject, boolean4 || boolean5, boolean0, boolean1, _int, boolean2, boolean3);
        this.calculateWallAlphaCommon(isoObject, boolean4 || boolean10, boolean6, boolean7, _int, boolean8, boolean9);
        boolean11 = boolean11 && !boolean2 && !boolean3;
        if (boolean11
            && isoObject.sprite.getType() == IsoObjectType.wall
            && (isoObject.sprite.getProperties().Is(IsoFlagType.transparentN) || isoObject.sprite.getProperties().Is(IsoFlagType.transparentW))
            && !isoObject.getSprite().getProperties().Is(IsoFlagType.exterior)
            && !isoObject.sprite.getProperties().Is(IsoFlagType.WindowN)
            && !isoObject.sprite.getProperties().Is(IsoFlagType.WindowW)) {
            boolean11 = false;
        }

        return boolean11;
    }

    public KahluaTable getLuaMovingObjectList() {
        KahluaTable kahluaTable = LuaManager.platform.newTable();
        LuaManager.env.rawset("Objects", kahluaTable);

        for (int _int = 0; _int < this.MovingObjects.size(); _int++) {
            kahluaTable.rawset(_int + 1, this.MovingObjects.get(_int));
        }

        return kahluaTable;
    }

    public boolean Is(IsoFlagType flag) {
        return this.Properties.Is(flag);
    }

    public boolean Is(String flag) {
        return this.Properties.Is(flag);
    }

    public boolean Has(IsoObjectType type) {
        return this.hasTypes.isSet(type);
    }

    public void DeleteTileObject(IsoObject obj) {
        this.Objects.remove(obj);
        this.RecalcAllWithNeighbours(true);
    }

    public KahluaTable getLuaTileObjectList() {
        KahluaTable kahluaTable = LuaManager.platform.newTable();
        LuaManager.env.rawset("Objects", kahluaTable);

        for (int _int = 0; _int < this.Objects.size(); _int++) {
            kahluaTable.rawset(_int + 1, this.Objects.get(_int));
        }

        return kahluaTable;
    }

    boolean HasDoor(boolean _boolean) {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            if (this.SpecialObjects.get(_int) instanceof IsoDoor && ((IsoDoor)this.SpecialObjects.get(_int)).north == _boolean) {
                return true;
            }

            if (this.SpecialObjects.get(_int) instanceof IsoThumpable
                && ((IsoThumpable)this.SpecialObjects.get(_int)).isDoor
                && ((IsoThumpable)this.SpecialObjects.get(_int)).north == _boolean) {
                return true;
            }
        }

        return false;
    }

    public boolean HasStairs() {
        return this.HasStairsNorth() || this.HasStairsWest();
    }

    public boolean HasStairsNorth() {
        return this.Has(IsoObjectType.stairsTN) || this.Has(IsoObjectType.stairsMN) || this.Has(IsoObjectType.stairsBN);
    }

    public boolean HasStairsWest() {
        return this.Has(IsoObjectType.stairsTW) || this.Has(IsoObjectType.stairsMW) || this.Has(IsoObjectType.stairsBW);
    }

    public boolean HasStairsBelow() {
        if (this.z == 0) {
            return false;
        } else {
            IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(this.x, this.y, this.z - 1);
            return isoGridSquare1 != null && isoGridSquare1.HasStairs();
        }
    }

    public boolean HasElevatedFloor() {
        return this.Has(IsoObjectType.stairsTN) || this.Has(IsoObjectType.stairsMN) || this.Has(IsoObjectType.stairsTW) || this.Has(IsoObjectType.stairsMW);
    }

    public boolean isSameStaircase(int _x, int _y, int _z) {
        if (_z != this.getZ()) {
            return false;
        } else {
            int int0 = this.getX();
            int int1 = this.getY();
            int int2 = int0;
            int int3 = int1;
            if (this.Has(IsoObjectType.stairsTN)) {
                int3 = int1 + 2;
            } else if (this.Has(IsoObjectType.stairsMN)) {
                int1--;
                int3++;
            } else if (this.Has(IsoObjectType.stairsBN)) {
                int1 -= 2;
            } else if (this.Has(IsoObjectType.stairsTW)) {
                int2 = int0 + 2;
            } else if (this.Has(IsoObjectType.stairsMW)) {
                int0--;
                int2++;
            } else {
                if (!this.Has(IsoObjectType.stairsBW)) {
                    return false;
                }

                int0 -= 2;
            }

            if (_x >= int0 && _y >= int1 && _x <= int2 && _y <= int3) {
                IsoGridSquare isoGridSquare = this.getCell().getGridSquare(_x, _y, _z);
                return isoGridSquare != null && isoGridSquare.HasStairs();
            } else {
                return false;
            }
        }
    }

    public boolean HasSlopedRoof() {
        return this.HasSlopedRoofWest() || this.HasSlopedRoofNorth();
    }

    public boolean HasSlopedRoofWest() {
        return this.Has(IsoObjectType.WestRoofB) || this.Has(IsoObjectType.WestRoofM) || this.Has(IsoObjectType.WestRoofT);
    }

    public boolean HasSlopedRoofNorth() {
        return this.Has(IsoObjectType.WestRoofB) || this.Has(IsoObjectType.WestRoofM) || this.Has(IsoObjectType.WestRoofT);
    }

    public boolean HasTree() {
        return this.hasTree;
    }

    public IsoTree getTree() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoTree isoTree = Type.tryCastTo(this.Objects.get(_int), IsoTree.class);
            if (isoTree != null) {
                return isoTree;
            }
        }

        return null;
    }

    private void fudgeShadowsToAlpha(IsoObject isoObject, Color color) {
        float _float = 1.0F - isoObject.getAlpha();
        if (color.r < _float) {
            color.r = _float;
        }

        if (color.g < _float) {
            color.g = _float;
        }

        if (color.b < _float) {
            color.b = _float;
        }
    }

    public boolean shouldSave() {
        return !this.Objects.isEmpty();
    }

    public void save(ByteBuffer output, ObjectOutputStream outputObj) throws IOException {
        this.save(output, outputObj, false);
    }

    public void save(ByteBuffer output, ObjectOutputStream outputObj, boolean IS_DEBUG_SAVE) throws IOException {
        this.getErosionData().save(output);
        BitHeaderWrite bitHeaderWrite0 = BitHeader.allocWrite(BitHeader.HeaderSize.Byte, output);
        int int0 = this.Objects.size();
        if (this.Objects.size() > 0) {
            bitHeaderWrite0.addFlags(1);
            if (int0 == 2) {
                bitHeaderWrite0.addFlags(2);
            } else if (int0 == 3) {
                bitHeaderWrite0.addFlags(4);
            } else if (int0 >= 4) {
                bitHeaderWrite0.addFlags(8);
            }

            if (IS_DEBUG_SAVE) {
                zombie.GameWindow.WriteString(output, "Number of objects (" + int0 + ")");
            }

            if (int0 >= 4) {
                output.putShort((short)this.Objects.size());
            }

            for (int int1 = 0; int1 < this.Objects.size(); int1++) {
                int int2 = output.position();
                if (IS_DEBUG_SAVE) {
                    output.putInt(0);
                }

                byte _byte = 0;
                if (this.SpecialObjects.contains(this.Objects.get(int1))) {
                    _byte = (byte)(_byte | 2);
                }

                if (this.WorldObjects.contains(this.Objects.get(int1))) {
                    _byte = (byte)(_byte | 4);
                }

                output.put(_byte);
                if (IS_DEBUG_SAVE) {
                    zombie.GameWindow.WriteStringUTF(output, this.Objects.get(int1).getClass().getName());
                }

                this.Objects.get(int1).save(output, IS_DEBUG_SAVE);
                if (IS_DEBUG_SAVE) {
                    int int3 = output.position();
                    output.position(int2);
                    output.putInt(int3 - int2);
                    output.position(int3);
                }
            }

            if (IS_DEBUG_SAVE) {
                output.put((byte)67);
                output.put((byte)82);
                output.put((byte)80);
                output.put((byte)83);
            }
        }

        if (this.isOverlayDone()) {
            bitHeaderWrite0.addFlags(16);
        }

        if (this.haveRoof) {
            bitHeaderWrite0.addFlags(32);
        }

        BitHeaderWrite bitHeaderWrite1 = BitHeader.allocWrite(BitHeader.HeaderSize.Byte, output);
        int int4 = 0;

        for (int int5 = 0; int5 < this.StaticMovingObjects.size(); int5++) {
            if (this.StaticMovingObjects.get(int5) instanceof IsoDeadBody) {
                int4++;
            }
        }

        if (int4 > 0) {
            bitHeaderWrite1.addFlags(1);
            if (IS_DEBUG_SAVE) {
                zombie.GameWindow.WriteString(output, "Number of bodies");
            }

            output.putShort((short)int4);

            for (int int6 = 0; int6 < this.StaticMovingObjects.size(); int6++) {
                IsoMovingObject isoMovingObject = (IsoMovingObject)this.StaticMovingObjects.get(int6);
                if (isoMovingObject instanceof IsoDeadBody) {
                    if (IS_DEBUG_SAVE) {
                        zombie.GameWindow.WriteStringUTF(output, isoMovingObject.getClass().getName());
                    }

                    isoMovingObject.save(output, IS_DEBUG_SAVE);
                }
            }
        }

        if (this.table != null && !this.table.isEmpty()) {
            bitHeaderWrite1.addFlags(2);
            this.table.save(output);
        }

        if (this.burntOut) {
            bitHeaderWrite1.addFlags(4);
        }

        if (this.getTrapPositionX() > 0) {
            bitHeaderWrite1.addFlags(8);
            output.putInt(this.getTrapPositionX());
            output.putInt(this.getTrapPositionY());
            output.putInt(this.getTrapPositionZ());
        }

        if (this.haveSheetRope) {
            bitHeaderWrite1.addFlags(16);
        }

        if (!bitHeaderWrite1.equals(0)) {
            bitHeaderWrite0.addFlags(64);
            bitHeaderWrite1.write();
        } else {
            output.position(bitHeaderWrite1.getStartPosition());
        }

        bitHeaderWrite0.write();
        bitHeaderWrite0.release();
        bitHeaderWrite1.release();
    }

    static void loadmatrix(boolean[][][] var0, DataInputStream var1) throws IOException {
    }

    static void savematrix(boolean[][][] _boolean, DataOutputStream dataOutputStream) throws IOException {
        for (int int0 = 0; int0 < 3; int0++) {
            for (int int1 = 0; int1 < 3; int1++) {
                for (int int2 = 0; int2 < 3; int2++) {
                    dataOutputStream.writeBoolean(_boolean[int0][int1][int2]);
                }
            }
        }
    }

    public boolean isCommonGrass() {
        if (this.Objects.isEmpty()) {
            return false;
        } else {
            IsoObject isoObject = this.Objects.get(0);
            return isoObject.sprite.getProperties().Is(IsoFlagType.solidfloor)
                && ("TileFloorExt_3".equals(isoObject.tile) || "TileFloorExt_4".equals(isoObject.tile));
        }
    }

    public static boolean toBoolean(byte[] _byte) {
        return _byte != null && _byte.length != 0 ? _byte[0] != 0 : false;
    }

    public void removeCorpse(IsoDeadBody body, boolean bRemote) {
        if (GameClient.bClient && !bRemote) {
            try {
                GameClient.instance.checkAddedRemovedItems(body);
            } catch (Exception exception) {
                GameClient.connection.cancelPacket();
                ExceptionLogger.logException(exception);
            }

            GameClient.sendRemoveCorpseFromMap(body);
        }

        body.removeFromWorld();
        body.removeFromSquare();
        if (!GameServer.bServer) {
            LuaEventManager.triggerEvent("OnContainerUpdate", this);
        }
    }

    public IsoDeadBody getDeadBody() {
        for (int _int = 0; _int < this.StaticMovingObjects.size(); _int++) {
            if (this.StaticMovingObjects.get(_int) instanceof IsoDeadBody) {
                return (IsoDeadBody)this.StaticMovingObjects.get(_int);
            }
        }

        return null;
    }

    public List<IsoDeadBody> getDeadBodys() {
        ArrayList arrayList = new ArrayList();

        for (int _int = 0; _int < this.StaticMovingObjects.size(); _int++) {
            if (this.StaticMovingObjects.get(_int) instanceof IsoDeadBody) {
                arrayList.add((IsoDeadBody)this.StaticMovingObjects.get(_int));
            }
        }

        return arrayList;
    }

    public void addCorpse(IsoDeadBody body, boolean bRemote) {
        if (GameClient.bClient && !bRemote) {
            ByteBufferWriter byteBufferWriter = GameClient.connection.startPacket();
            PacketTypes.PacketType.AddCorpseToMap.doPacket(byteBufferWriter);
            byteBufferWriter.putShort(body.getObjectID());
            byteBufferWriter.putShort(body.getOnlineID());
            byteBufferWriter.putInt(this.x);
            byteBufferWriter.putInt(this.y);
            byteBufferWriter.putInt(this.z);
            body.writeToRemoteBuffer(byteBufferWriter);
            PacketTypes.PacketType.AddCorpseToMap.send(GameClient.connection);
        }

        if (!this.StaticMovingObjects.contains(body)) {
            this.StaticMovingObjects.add(body);
        }

        body.addToWorld();
        this.burntOut = false;
        this.Properties.UnSet(IsoFlagType.burntOut);
    }

    public IsoBrokenGlass getBrokenGlass() {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoBrokenGlass) {
                return (IsoBrokenGlass)isoObject;
            }
        }

        return null;
    }

    public IsoBrokenGlass addBrokenGlass() {
        if (!this.isFree(false)) {
            return this.getBrokenGlass();
        } else {
            IsoBrokenGlass isoBrokenGlass = this.getBrokenGlass();
            if (isoBrokenGlass == null) {
                isoBrokenGlass = new IsoBrokenGlass(this.getCell());
                isoBrokenGlass.setSquare(this);
                this.AddSpecialObject(isoBrokenGlass);
                if (GameServer.bServer) {
                    GameServer.transmitBrokenGlass(this);
                }
            }

            return isoBrokenGlass;
        }
    }

    public void load(ByteBuffer b, int WorldVersion) throws IOException {
        this.load(b, WorldVersion, false);
    }

    public void load(ByteBuffer b, int WorldVersion, boolean IS_DEBUG_SAVE) throws IOException {
        this.getErosionData().load(b, WorldVersion);
        BitHeaderRead bitHeaderRead0 = BitHeader.allocRead(BitHeader.HeaderSize.Byte, b);
        if (!bitHeaderRead0.equals(0)) {
            if (bitHeaderRead0.hasFlags(1)) {
                if (IS_DEBUG_SAVE) {
                    String string0 = zombie.GameWindow.ReadStringUTF(b);
                    DebugLog.log(string0);
                }

                short short0 = 1;
                if (bitHeaderRead0.hasFlags(2)) {
                    short0 = 2;
                } else if (bitHeaderRead0.hasFlags(4)) {
                    short0 = 3;
                } else if (bitHeaderRead0.hasFlags(8)) {
                    short0 = b.getShort();
                }

                for (int int0 = 0; int0 < short0; int0++) {
                    int int1 = b.position();
                    int int2 = 0;
                    if (IS_DEBUG_SAVE) {
                        int2 = b.getInt();
                    }

                    byte byte0 = b.get();
                    boolean boolean0 = (byte0 & 2) != 0;
                    boolean boolean1 = (byte0 & 4) != 0;
                    IsoObject isoObject = null;
                    if (IS_DEBUG_SAVE) {
                        String string1 = zombie.GameWindow.ReadStringUTF(b);
                        DebugLog.log(string1);
                    }

                    isoObject = IsoObject.factoryFromFileInput(this.getCell(), b);
                    if (isoObject == null) {
                        if (IS_DEBUG_SAVE) {
                            int int3 = b.position();
                            if (int3 - int1 != int2) {
                                DebugLog.log(
                                    "***** Object loaded size "
                                        + (int3 - int1)
                                        + " != saved size "
                                        + int2
                                        + ", reading obj size: "
                                        + short0
                                        + ", Object == null"
                                );
                                if (isoObject.getSprite() != null && isoObject.getSprite().getName() != null) {
                                    DebugLog.log("Obj sprite = " + isoObject.getSprite().getName());
                                }
                            }
                        }
                    } else {
                        isoObject.square = this;

                        try {
                            isoObject.load(b, WorldVersion, IS_DEBUG_SAVE);
                        } catch (Exception exception0) {
                            this.debugPrintGridSquare();
                            if (lastLoaded != null) {
                                lastLoaded.debugPrintGridSquare();
                            }

                            throw new RuntimeException(exception0);
                        }

                        if (IS_DEBUG_SAVE) {
                            int int4 = b.position();
                            if (int4 - int1 != int2) {
                                DebugLog.log("***** Object loaded size " + (int4 - int1) + " != saved size " + int2 + ", reading obj size: " + short0);
                                if (isoObject.getSprite() != null && isoObject.getSprite().getName() != null) {
                                    DebugLog.log("Obj sprite = " + isoObject.getSprite().getName());
                                }
                            }
                        }

                        if (isoObject instanceof IsoWorldInventoryObject) {
                            if (((IsoWorldInventoryObject)isoObject).getItem() == null) {
                                continue;
                            }

                            String string2 = ((IsoWorldInventoryObject)isoObject).getItem().getFullType();
                            Item item = ScriptManager.instance.FindItem(string2);
                            if (item != null && item.getObsolete()) {
                                continue;
                            }

                            String[] string3 = string2.split("_");
                            if (((IsoWorldInventoryObject)isoObject).dropTime > -1.0
                                && zombie.SandboxOptions.instance.HoursForWorldItemRemoval.getValue() > 0.0
                                && (
                                    zombie.SandboxOptions.instance.WorldItemRemovalList.getValue().contains(string3[0])
                                            && !zombie.SandboxOptions.instance.ItemRemovalListBlacklistToggle.getValue()
                                        || !zombie.SandboxOptions.instance.WorldItemRemovalList.getValue().contains(string3[0])
                                            && zombie.SandboxOptions.instance.ItemRemovalListBlacklistToggle.getValue()
                                )
                                && !((IsoWorldInventoryObject)isoObject).isIgnoreRemoveSandbox()
                                && zombie.GameTime.instance.getWorldAgeHours()
                                    > ((IsoWorldInventoryObject)isoObject).dropTime + zombie.SandboxOptions.instance.HoursForWorldItemRemoval.getValue()) {
                                continue;
                            }
                        }

                        if (!(isoObject instanceof IsoWindow)
                            || isoObject.getSprite() == null
                            || !"walls_special_01_8".equals(isoObject.getSprite().getName()) && !"walls_special_01_9".equals(isoObject.getSprite().getName())) {
                            this.Objects.add(isoObject);
                            if (boolean0) {
                                this.SpecialObjects.add(isoObject);
                            }

                            if (boolean1) {
                                if (Core.bDebug && !(isoObject instanceof IsoWorldInventoryObject)) {
                                    DebugLog.log(
                                        "Bitflags = "
                                            + byte0
                                            + ", obj name = "
                                            + isoObject.getObjectName()
                                            + ", sprite = "
                                            + (isoObject.getSprite() != null ? isoObject.getSprite().getName() : "unknown")
                                    );
                                }

                                this.WorldObjects.add((IsoWorldInventoryObject)isoObject);
                                isoObject.square.chunk.recalcHashCodeObjects();
                            }
                        }
                    }
                }

                if (IS_DEBUG_SAVE) {
                    byte byte1 = b.get();
                    byte byte2 = b.get();
                    byte byte3 = b.get();
                    byte byte4 = b.get();
                    if (byte1 != 67 || byte2 != 82 || byte3 != 80 || byte4 != 83) {
                        DebugLog.log("***** Expected CRPS here");
                    }
                }
            }

            this.setOverlayDone(bitHeaderRead0.hasFlags(16));
            this.haveRoof = bitHeaderRead0.hasFlags(32);
            if (bitHeaderRead0.hasFlags(64)) {
                BitHeaderRead bitHeaderRead1 = BitHeader.allocRead(BitHeader.HeaderSize.Byte, b);
                if (bitHeaderRead1.hasFlags(1)) {
                    if (IS_DEBUG_SAVE) {
                        String string4 = zombie.GameWindow.ReadStringUTF(b);
                        DebugLog.log(string4);
                    }

                    short short1 = b.getShort();

                    for (int int5 = 0; int5 < short1; int5++) {
                        IsoMovingObject isoMovingObject = null;
                        if (IS_DEBUG_SAVE) {
                            String string5 = zombie.GameWindow.ReadStringUTF(b);
                            DebugLog.log(string5);
                        }

                        try {
                            isoMovingObject = (IsoMovingObject)IsoObject.factoryFromFileInput(this.getCell(), b);
                        } catch (Exception exception1) {
                            this.debugPrintGridSquare();
                            if (lastLoaded != null) {
                                lastLoaded.debugPrintGridSquare();
                            }

                            throw new RuntimeException(exception1);
                        }

                        if (isoMovingObject != null) {
                            isoMovingObject.square = this;
                            isoMovingObject.current = this;

                            try {
                                isoMovingObject.load(b, WorldVersion, IS_DEBUG_SAVE);
                            } catch (Exception exception2) {
                                this.debugPrintGridSquare();
                                if (lastLoaded != null) {
                                    lastLoaded.debugPrintGridSquare();
                                }

                                throw new RuntimeException(exception2);
                            }

                            this.StaticMovingObjects.add(isoMovingObject);
                            this.recalcHashCodeObjects();
                        }
                    }
                }

                if (bitHeaderRead1.hasFlags(2)) {
                    if (this.table == null) {
                        this.table = LuaManager.platform.newTable();
                    }

                    this.table.load(b, WorldVersion);
                }

                this.burntOut = bitHeaderRead1.hasFlags(4);
                if (bitHeaderRead1.hasFlags(8)) {
                    this.setTrapPositionX(b.getInt());
                    this.setTrapPositionY(b.getInt());
                    this.setTrapPositionZ(b.getInt());
                }

                this.haveSheetRope = bitHeaderRead1.hasFlags(16);
                bitHeaderRead1.release();
            }
        }

        bitHeaderRead0.release();
        lastLoaded = this;
    }

    private void debugPrintGridSquare() {
        System.out.println("x=" + this.x + " y=" + this.y + " z=" + this.z);
        System.out.println("objects");

        for (int int0 = 0; int0 < this.Objects.size(); int0++) {
            this.Objects.get(int0).debugPrintout();
        }

        System.out.println("staticmovingobjects");

        for (int int1 = 0; int1 < this.StaticMovingObjects.size(); int1++) {
            this.Objects.get(int1).debugPrintout();
        }
    }

    public float scoreAsWaypoint(int _x, int _y) {
        float _float = 2.0F;
        return _float - IsoUtils.DistanceManhatten((float)_x, (float)_y, (float)this.getX(), (float)this.getY()) * 5.0F;
    }

    public void InvalidateSpecialObjectPaths() {
    }

    public boolean isSolid() {
        return this.Properties.Is(IsoFlagType.solid);
    }

    public boolean isSolidTrans() {
        return this.Properties.Is(IsoFlagType.solidtrans);
    }

    public boolean isFree(boolean bCountOtherCharacters) {
        if (bCountOtherCharacters && this.MovingObjects.size() > 0) {
            return false;
        } else if (this.CachedIsFree) {
            return this.CacheIsFree;
        } else {
            this.CachedIsFree = true;
            this.CacheIsFree = true;
            if (this.Properties.Is(IsoFlagType.solid) || this.Properties.Is(IsoFlagType.solidtrans) || this.Has(IsoObjectType.tree)) {
                this.CacheIsFree = false;
            }

            if (!this.Properties.Is(IsoFlagType.solidfloor)) {
                this.CacheIsFree = false;
            }

            if (this.Has(IsoObjectType.stairsBN) || this.Has(IsoObjectType.stairsMN) || this.Has(IsoObjectType.stairsTN)) {
                this.CacheIsFree = true;
            } else if (this.Has(IsoObjectType.stairsBW) || this.Has(IsoObjectType.stairsMW) || this.Has(IsoObjectType.stairsTW)) {
                this.CacheIsFree = true;
            }

            return this.CacheIsFree;
        }
    }

    public boolean isFreeOrMidair(boolean bCountOtherCharacters) {
        if (bCountOtherCharacters && this.MovingObjects.size() > 0) {
            return false;
        } else {
            boolean _boolean = true;
            if (this.Properties.Is(IsoFlagType.solid) || this.Properties.Is(IsoFlagType.solidtrans) || this.Has(IsoObjectType.tree)) {
                _boolean = false;
            }

            if (this.Has(IsoObjectType.stairsBN) || this.Has(IsoObjectType.stairsMN) || this.Has(IsoObjectType.stairsTN)) {
                _boolean = true;
            } else if (this.Has(IsoObjectType.stairsBW) || this.Has(IsoObjectType.stairsMW) || this.Has(IsoObjectType.stairsTW)) {
                _boolean = true;
            }

            return _boolean;
        }
    }

    public boolean isFreeOrMidair(boolean bCountOtherCharacters, boolean bDoZombie) {
        if (bCountOtherCharacters && this.MovingObjects.size() > 0) {
            if (!bDoZombie) {
                return false;
            }

            for (int _int = 0; _int < this.MovingObjects.size(); _int++) {
                IsoMovingObject isoMovingObject = (IsoMovingObject)this.MovingObjects.get(_int);
                if (!(isoMovingObject instanceof IsoDeadBody)) {
                    return false;
                }
            }
        }

        boolean _boolean = true;
        if (this.Properties.Is(IsoFlagType.solid) || this.Properties.Is(IsoFlagType.solidtrans) || this.Has(IsoObjectType.tree)) {
            _boolean = false;
        }

        if (this.Has(IsoObjectType.stairsBN) || this.Has(IsoObjectType.stairsMN) || this.Has(IsoObjectType.stairsTN)) {
            _boolean = true;
        } else if (this.Has(IsoObjectType.stairsBW) || this.Has(IsoObjectType.stairsMW) || this.Has(IsoObjectType.stairsTW)) {
            _boolean = true;
        }

        return _boolean;
    }

    public boolean connectedWithFloor() {
        if (this.getZ() == 0) {
            return true;
        } else {
            Object object = null;
            object = this.getCell().getGridSquare(this.getX() - 1, this.getY(), this.getZ());
            if (object != null && ((IsoGridSquare)object).Properties.Is(IsoFlagType.solidfloor)) {
                return true;
            } else {
                object = this.getCell().getGridSquare(this.getX() + 1, this.getY(), this.getZ());
                if (object != null && ((IsoGridSquare)object).Properties.Is(IsoFlagType.solidfloor)) {
                    return true;
                } else {
                    object = this.getCell().getGridSquare(this.getX(), this.getY() - 1, this.getZ());
                    if (object != null && ((IsoGridSquare)object).Properties.Is(IsoFlagType.solidfloor)) {
                        return true;
                    } else {
                        object = this.getCell().getGridSquare(this.getX(), this.getY() + 1, this.getZ());
                        return object != null && ((IsoGridSquare)object).Properties.Is(IsoFlagType.solidfloor);
                    }
                }
            }
        }
    }

    public boolean hasFloor(boolean north) {
        if (this.Properties.Is(IsoFlagType.solidfloor)) {
            return true;
        } else {
            Object object = null;
            if (north) {
                object = this.getCell().getGridSquare(this.getX(), this.getY() - 1, this.getZ());
            } else {
                object = this.getCell().getGridSquare(this.getX() - 1, this.getY(), this.getZ());
            }

            return object != null && ((IsoGridSquare)object).Properties.Is(IsoFlagType.solidfloor);
        }
    }

    public boolean isNotBlocked(boolean bCountOtherCharacters) {
        if (!this.CachedIsFree) {
            this.CacheIsFree = true;
            this.CachedIsFree = true;
            if (this.Properties.Is(IsoFlagType.solid) || this.Properties.Is(IsoFlagType.solidtrans)) {
                this.CacheIsFree = false;
            }

            if (!this.Properties.Is(IsoFlagType.solidfloor)) {
                this.CacheIsFree = false;
            }
        } else if (!this.CacheIsFree) {
            return false;
        }

        return !bCountOtherCharacters || this.MovingObjects.size() <= 0;
    }

    public IsoObject getDoor(boolean north) {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoThumpable isoThumpable && isoThumpable.isDoor() && north == isoThumpable.north) {
                return isoThumpable;
            }

            if (isoObject instanceof IsoDoor isoDoor && north == isoDoor.north) {
                return isoDoor;
            }
        }

        return null;
    }

    public IsoDoor getIsoDoor() {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoDoor) {
                return (IsoDoor)isoObject;
            }
        }

        return null;
    }

    public IsoObject getDoorTo(IsoGridSquare next) {
        if (next != null && next != this) {
            IsoObject isoObject = null;
            if (next.x < this.x) {
                isoObject = this.getDoor(false);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.y < this.y) {
                isoObject = this.getDoor(true);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.x > this.x) {
                isoObject = next.getDoor(false);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.y > this.y) {
                isoObject = next.getDoor(true);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.x != this.x && next.y != this.y) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, next.y, this.z);
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(next.x, this.y, this.z);
                isoObject = this.getDoorTo(isoGridSquare0);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = this.getDoorTo(isoGridSquare1);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = next.getDoorTo(isoGridSquare0);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = next.getDoorTo(isoGridSquare1);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            return null;
        } else {
            return null;
        }
    }

    public IsoWindow getWindow(boolean north) {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoWindow isoWindow && north == isoWindow.north) {
                return isoWindow;
            }
        }

        return null;
    }

    public IsoWindow getWindow() {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoWindow) {
                return (IsoWindow)isoObject;
            }
        }

        return null;
    }

    public IsoWindow getWindowTo(IsoGridSquare next) {
        if (next != null && next != this) {
            IsoWindow isoWindow = null;
            if (next.x < this.x) {
                isoWindow = this.getWindow(false);
                if (isoWindow != null) {
                    return isoWindow;
                }
            }

            if (next.y < this.y) {
                isoWindow = this.getWindow(true);
                if (isoWindow != null) {
                    return isoWindow;
                }
            }

            if (next.x > this.x) {
                isoWindow = next.getWindow(false);
                if (isoWindow != null) {
                    return isoWindow;
                }
            }

            if (next.y > this.y) {
                isoWindow = next.getWindow(true);
                if (isoWindow != null) {
                    return isoWindow;
                }
            }

            if (next.x != this.x && next.y != this.y) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, next.y, this.z);
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(next.x, this.y, this.z);
                isoWindow = this.getWindowTo(isoGridSquare0);
                if (isoWindow != null) {
                    return isoWindow;
                }

                isoWindow = this.getWindowTo(isoGridSquare1);
                if (isoWindow != null) {
                    return isoWindow;
                }

                isoWindow = next.getWindowTo(isoGridSquare0);
                if (isoWindow != null) {
                    return isoWindow;
                }

                isoWindow = next.getWindowTo(isoGridSquare1);
                if (isoWindow != null) {
                    return isoWindow;
                }
            }

            return null;
        } else {
            return null;
        }
    }

    public boolean isAdjacentToWindow() {
        if (this.getWindow() != null) {
            return true;
        } else if (this.hasWindowFrame()) {
            return true;
        } else if (this.getThumpableWindow(false) == null && this.getThumpableWindow(true) == null) {
            IsoGridSquare isoGridSquare1 = this.nav[IsoDirections.S.index()];
            if (isoGridSquare1 == null
                || isoGridSquare1.getWindow(true) == null && isoGridSquare1.getWindowFrame(true) == null && isoGridSquare1.getThumpableWindow(true) == null) {
                IsoGridSquare isoGridSquare2 = this.nav[IsoDirections.E.index()];
                return isoGridSquare2 != null
                    && (
                        isoGridSquare2.getWindow(false) != null
                            || isoGridSquare2.getWindowFrame(false) != null
                            || isoGridSquare2.getThumpableWindow(false) != null
                    );
            } else {
                return true;
            }
        } else {
            return true;
        }
    }

    public IsoThumpable getThumpableWindow(boolean north) {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoThumpable isoThumpable && isoThumpable.isWindow() && north == isoThumpable.north) {
                return isoThumpable;
            }
        }

        return null;
    }

    public IsoThumpable getWindowThumpableTo(IsoGridSquare next) {
        if (next != null && next != this) {
            IsoThumpable isoThumpable = null;
            if (next.x < this.x) {
                isoThumpable = this.getThumpableWindow(false);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.y < this.y) {
                isoThumpable = this.getThumpableWindow(true);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.x > this.x) {
                isoThumpable = next.getThumpableWindow(false);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.y > this.y) {
                isoThumpable = next.getThumpableWindow(true);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.x != this.x && next.y != this.y) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, next.y, this.z);
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(next.x, this.y, this.z);
                isoThumpable = this.getWindowThumpableTo(isoGridSquare0);
                if (isoThumpable != null) {
                    return isoThumpable;
                }

                isoThumpable = this.getWindowThumpableTo(isoGridSquare1);
                if (isoThumpable != null) {
                    return isoThumpable;
                }

                isoThumpable = next.getWindowThumpableTo(isoGridSquare0);
                if (isoThumpable != null) {
                    return isoThumpable;
                }

                isoThumpable = next.getWindowThumpableTo(isoGridSquare1);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            return null;
        } else {
            return null;
        }
    }

    public IsoThumpable getHoppableThumpable(boolean north) {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoThumpable isoThumpable && isoThumpable.isHoppable() && north == isoThumpable.north) {
                return isoThumpable;
            }
        }

        return null;
    }

    public IsoThumpable getHoppableThumpableTo(IsoGridSquare next) {
        if (next != null && next != this) {
            IsoThumpable isoThumpable = null;
            if (next.x < this.x) {
                isoThumpable = this.getHoppableThumpable(false);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.y < this.y) {
                isoThumpable = this.getHoppableThumpable(true);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.x > this.x) {
                isoThumpable = next.getHoppableThumpable(false);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.y > this.y) {
                isoThumpable = next.getHoppableThumpable(true);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            if (next.x != this.x && next.y != this.y) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, next.y, this.z);
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(next.x, this.y, this.z);
                isoThumpable = this.getHoppableThumpableTo(isoGridSquare0);
                if (isoThumpable != null) {
                    return isoThumpable;
                }

                isoThumpable = this.getHoppableThumpableTo(isoGridSquare1);
                if (isoThumpable != null) {
                    return isoThumpable;
                }

                isoThumpable = next.getHoppableThumpableTo(isoGridSquare0);
                if (isoThumpable != null) {
                    return isoThumpable;
                }

                isoThumpable = next.getHoppableThumpableTo(isoGridSquare1);
                if (isoThumpable != null) {
                    return isoThumpable;
                }
            }

            return null;
        } else {
            return null;
        }
    }

    public IsoObject getWallHoppable(boolean north) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            if (this.Objects.get(_int).isHoppable() && north == this.Objects.get(_int).isNorthHoppable()) {
                return this.Objects.get(_int);
            }
        }

        return null;
    }

    public IsoObject getWallHoppableTo(IsoGridSquare next) {
        if (next != null && next != this) {
            IsoObject isoObject = null;
            if (next.x < this.x) {
                isoObject = this.getWallHoppable(false);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.y < this.y) {
                isoObject = this.getWallHoppable(true);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.x > this.x) {
                isoObject = next.getWallHoppable(false);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.y > this.y) {
                isoObject = next.getWallHoppable(true);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.x != this.x && next.y != this.y) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, next.y, this.z);
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(next.x, this.y, this.z);
                isoObject = this.getWallHoppableTo(isoGridSquare0);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = this.getWallHoppableTo(isoGridSquare1);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = next.getWallHoppableTo(isoGridSquare0);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = next.getWallHoppableTo(isoGridSquare1);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            return null;
        } else {
            return null;
        }
    }

    public IsoObject getBedTo(IsoGridSquare next) {
        ArrayList arrayList = null;
        if (next.y >= this.y && next.x >= this.x) {
            arrayList = next.SpecialObjects;
        } else {
            arrayList = this.SpecialObjects;
        }

        for (int _int = 0; _int < arrayList.size(); _int++) {
            IsoObject isoObject = (IsoObject)arrayList.get(_int);
            if (isoObject.getProperties().Is(IsoFlagType.bed)) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getWindowFrame(boolean north) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (!(isoObject instanceof IsoWorldInventoryObject) && IsoWindowFrame.isWindowFrame(isoObject, north)) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getWindowFrameTo(IsoGridSquare next) {
        if (next != null && next != this) {
            IsoObject isoObject = null;
            if (next.x < this.x) {
                isoObject = this.getWindowFrame(false);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.y < this.y) {
                isoObject = this.getWindowFrame(true);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.x > this.x) {
                isoObject = next.getWindowFrame(false);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.y > this.y) {
                isoObject = next.getWindowFrame(true);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            if (next.x != this.x && next.y != this.y) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, next.y, this.z);
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(next.x, this.y, this.z);
                isoObject = this.getWindowFrameTo(isoGridSquare0);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = this.getWindowFrameTo(isoGridSquare1);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = next.getWindowFrameTo(isoGridSquare0);
                if (isoObject != null) {
                    return isoObject;
                }

                isoObject = next.getWindowFrameTo(isoGridSquare1);
                if (isoObject != null) {
                    return isoObject;
                }
            }

            return null;
        } else {
            return null;
        }
    }

    public boolean hasWindowFrame() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (!(isoObject instanceof IsoWorldInventoryObject) && IsoWindowFrame.isWindowFrame(isoObject)) {
                return true;
            }
        }

        return false;
    }

    public boolean hasWindowOrWindowFrame() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (!(isoObject instanceof IsoWorldInventoryObject)
                && (this.isWindowOrWindowFrame(isoObject, true) || this.isWindowOrWindowFrame(isoObject, false))) {
                return true;
            }
        }

        return false;
    }

    private IsoObject getSpecialWall(boolean _boolean) {
        for (int _int = this.SpecialObjects.size() - 1; _int >= 0; _int--) {
            IsoObject isoObject0 = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject0 instanceof IsoThumpable isoThumpable) {
                if (isoThumpable.isStairs()
                    || !isoThumpable.isThumpable() && !isoThumpable.isWindow() && !isoThumpable.isDoor()
                    || isoThumpable.isDoor() && isoThumpable.open
                    || isoThumpable.isBlockAllTheSquare()) {
                    continue;
                }

                if (_boolean == isoThumpable.north && !isoThumpable.isCorner()) {
                    return isoThumpable;
                }
            }

            if (isoObject0 instanceof IsoWindow isoWindow && _boolean == isoWindow.north) {
                return isoWindow;
            }

            if (isoObject0 instanceof IsoDoor isoDoor && _boolean == isoDoor.north && !isoDoor.open) {
                return isoDoor;
            }
        }

        if ((!_boolean || this.Is(IsoFlagType.WindowN)) && (_boolean || this.Is(IsoFlagType.WindowW))) {
            IsoObject isoObject1 = this.getWindowFrame(_boolean);
            return isoObject1 != null ? isoObject1 : null;
        } else {
            return null;
        }
    }

    public IsoObject getSheetRope() {
        for (int _int = 0; _int < this.getObjects().size(); _int++) {
            IsoObject isoObject = this.getObjects().get(_int);
            if (isoObject.sheetRope) {
                return isoObject;
            }
        }

        return null;
    }

    public boolean damageSpriteSheetRopeFromBottom(IsoPlayer player, boolean north) {
        IsoGridSquare isoGridSquare = this;
        IsoFlagType isoFlagType;
        if (north) {
            if (this.Is(IsoFlagType.climbSheetN)) {
                isoFlagType = IsoFlagType.climbSheetN;
            } else {
                if (!this.Is(IsoFlagType.climbSheetS)) {
                    return false;
                }

                isoFlagType = IsoFlagType.climbSheetS;
            }
        } else if (this.Is(IsoFlagType.climbSheetW)) {
            isoFlagType = IsoFlagType.climbSheetW;
        } else {
            if (!this.Is(IsoFlagType.climbSheetE)) {
                return false;
            }

            isoFlagType = IsoFlagType.climbSheetE;
        }

        while (isoGridSquare != null) {
            for (int int0 = 0; int0 < isoGridSquare.getObjects().size(); int0++) {
                IsoObject isoObject = isoGridSquare.getObjects().get(int0);
                if (isoObject.getProperties() != null && isoObject.getProperties().Is(isoFlagType)) {
                    int int1 = Integer.parseInt(isoObject.getSprite().getName().split("_")[2]);
                    if (int1 > 14) {
                        return false;
                    }

                    String string = isoObject.getSprite().getName().split("_")[0] + "_" + isoObject.getSprite().getName().split("_")[1];
                    int1 += 40;
                    isoObject.setSprite(IsoSpriteManager.instance.getSprite(string + "_" + int1));
                    isoObject.transmitUpdatedSprite();
                    break;
                }
            }

            if (isoGridSquare.getZ() == 7) {
                break;
            }

            isoGridSquare = isoGridSquare.getCell().getGridSquare(isoGridSquare.getX(), isoGridSquare.getY(), isoGridSquare.getZ() + 1);
        }

        return true;
    }

    public boolean removeSheetRopeFromBottom(IsoPlayer player, boolean north) {
        IsoGridSquare isoGridSquare0 = this;
        IsoFlagType isoFlagType0;
        IsoFlagType isoFlagType1;
        if (north) {
            if (this.Is(IsoFlagType.climbSheetN)) {
                isoFlagType0 = IsoFlagType.climbSheetTopN;
                isoFlagType1 = IsoFlagType.climbSheetN;
            } else {
                if (!this.Is(IsoFlagType.climbSheetS)) {
                    return false;
                }

                isoFlagType0 = IsoFlagType.climbSheetTopS;
                isoFlagType1 = IsoFlagType.climbSheetS;
                String string0 = "crafted_01_4";

                for (int int0 = 0; int0 < isoGridSquare0.getObjects().size(); int0++) {
                    IsoObject isoObject0 = isoGridSquare0.getObjects().get(int0);
                    if (isoObject0.sprite != null && isoObject0.sprite.getName() != null && isoObject0.sprite.getName().equals(string0)) {
                        isoGridSquare0.transmitRemoveItemFromSquare(isoObject0);
                        break;
                    }
                }
            }
        } else if (this.Is(IsoFlagType.climbSheetW)) {
            isoFlagType0 = IsoFlagType.climbSheetTopW;
            isoFlagType1 = IsoFlagType.climbSheetW;
        } else {
            if (!this.Is(IsoFlagType.climbSheetE)) {
                return false;
            }

            isoFlagType0 = IsoFlagType.climbSheetTopE;
            isoFlagType1 = IsoFlagType.climbSheetE;
            String string1 = "crafted_01_3";

            for (int int1 = 0; int1 < isoGridSquare0.getObjects().size(); int1++) {
                IsoObject isoObject1 = isoGridSquare0.getObjects().get(int1);
                if (isoObject1.sprite != null && isoObject1.sprite.getName() != null && isoObject1.sprite.getName().equals(string1)) {
                    isoGridSquare0.transmitRemoveItemFromSquare(isoObject1);
                    break;
                }
            }
        }

        boolean _boolean = false;

        IsoGridSquare isoGridSquare1;
        for (isoGridSquare1 = null; isoGridSquare0 != null; _boolean = false) {
            for (int int2 = 0; int2 < isoGridSquare0.getObjects().size(); int2++) {
                IsoObject isoObject2 = isoGridSquare0.getObjects().get(int2);
                if (isoObject2.getProperties() != null && (isoObject2.getProperties().Is(isoFlagType0) || isoObject2.getProperties().Is(isoFlagType1))) {
                    isoGridSquare1 = isoGridSquare0;
                    _boolean = true;
                    isoGridSquare0.transmitRemoveItemFromSquare(isoObject2);
                    if (GameServer.bServer) {
                        if (player != null) {
                            player.sendObjectChange("addItemOfType", new Object[]{"type", isoObject2.getName()});
                        }
                    } else if (player != null) {
                        player.getInventory().AddItem(isoObject2.getName());
                    }
                    break;
                }
            }

            if (isoGridSquare0.getZ() == 7) {
                break;
            }

            isoGridSquare0 = isoGridSquare0.getCell().getGridSquare(isoGridSquare0.getX(), isoGridSquare0.getY(), isoGridSquare0.getZ() + 1);
        }

        if (!_boolean) {
            isoGridSquare0 = isoGridSquare1.getCell().getGridSquare(isoGridSquare1.getX(), isoGridSquare1.getY(), isoGridSquare1.getZ());
            IsoGridSquare isoGridSquare2 = north ? isoGridSquare0.nav[IsoDirections.S.index()] : isoGridSquare0.nav[IsoDirections.E.index()];
            if (isoGridSquare2 == null) {
                return true;
            }

            for (int int3 = 0; int3 < isoGridSquare2.getObjects().size(); int3++) {
                IsoObject isoObject3 = isoGridSquare2.getObjects().get(int3);
                if (isoObject3.getProperties() != null && (isoObject3.getProperties().Is(isoFlagType0) || isoObject3.getProperties().Is(isoFlagType1))) {
                    isoGridSquare2.transmitRemoveItemFromSquare(isoObject3);
                    break;
                }
            }
        }

        return true;
    }

    private IsoObject getSpecialSolid() {
        for (int int0 = 0; int0 < this.SpecialObjects.size(); int0++) {
            IsoObject isoObject0 = (IsoObject)this.SpecialObjects.get(int0);
            if (isoObject0 instanceof IsoThumpable isoThumpable && !isoThumpable.isStairs() && isoThumpable.isThumpable() && isoThumpable.isBlockAllTheSquare()
                )
             {
                if (isoThumpable.getProperties().Is(IsoFlagType.solidtrans) && this.isAdjacentToWindow()) {
                    return null;
                }

                return isoThumpable;
            }
        }

        for (int int1 = 0; int1 < this.Objects.size(); int1++) {
            IsoObject isoObject1 = this.Objects.get(int1);
            if (isoObject1.isMovedThumpable()) {
                if (this.isAdjacentToWindow()) {
                    return null;
                }

                return isoObject1;
            }
        }

        return null;
    }

    public IsoObject testCollideSpecialObjects(IsoGridSquare next) {
        if (next == null || next == this) {
            return null;
        } else if (next.x < this.x && next.y == this.y) {
            if (next.z == this.z && this.Has(IsoObjectType.stairsTW)) {
                return null;
            } else {
                IsoObject isoObject0 = this.getSpecialWall(false);
                if (isoObject0 != null) {
                    return isoObject0;
                } else if (this.isBlockedTo(next)) {
                    return null;
                } else {
                    isoObject0 = next.getSpecialSolid();
                    return isoObject0 != null ? isoObject0 : null;
                }
            }
        } else if (next.x == this.x && next.y < this.y) {
            if (next.z == this.z && this.Has(IsoObjectType.stairsTN)) {
                return null;
            } else {
                IsoObject isoObject1 = this.getSpecialWall(true);
                if (isoObject1 != null) {
                    return isoObject1;
                } else if (this.isBlockedTo(next)) {
                    return null;
                } else {
                    isoObject1 = next.getSpecialSolid();
                    return isoObject1 != null ? isoObject1 : null;
                }
            }
        } else if (next.x > this.x && next.y == this.y) {
            IsoObject isoObject2 = next.getSpecialWall(false);
            if (isoObject2 != null) {
                return isoObject2;
            } else if (this.isBlockedTo(next)) {
                return null;
            } else {
                isoObject2 = next.getSpecialSolid();
                return isoObject2 != null ? isoObject2 : null;
            }
        } else if (next.x == this.x && next.y > this.y) {
            IsoObject isoObject3 = next.getSpecialWall(true);
            if (isoObject3 != null) {
                return isoObject3;
            } else if (this.isBlockedTo(next)) {
                return null;
            } else {
                isoObject3 = next.getSpecialSolid();
                return isoObject3 != null ? isoObject3 : null;
            }
        } else if (next.x < this.x && next.y < this.y) {
            IsoObject isoObject4 = this.getSpecialWall(true);
            if (isoObject4 != null) {
                return isoObject4;
            } else {
                isoObject4 = this.getSpecialWall(false);
                if (isoObject4 != null) {
                    return isoObject4;
                } else {
                    IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, this.y - 1, this.z);
                    if (isoGridSquare0 != null && !this.isBlockedTo(isoGridSquare0)) {
                        isoObject4 = isoGridSquare0.getSpecialSolid();
                        if (isoObject4 != null) {
                            return isoObject4;
                        }

                        isoObject4 = isoGridSquare0.getSpecialWall(false);
                        if (isoObject4 != null) {
                            return isoObject4;
                        }
                    }

                    IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(this.x - 1, this.y, this.z);
                    if (isoGridSquare1 != null && !this.isBlockedTo(isoGridSquare1)) {
                        isoObject4 = isoGridSquare1.getSpecialSolid();
                        if (isoObject4 != null) {
                            return isoObject4;
                        }

                        isoObject4 = isoGridSquare1.getSpecialWall(true);
                        if (isoObject4 != null) {
                            return isoObject4;
                        }
                    }

                    if (isoGridSquare0 == null || this.isBlockedTo(isoGridSquare0) || isoGridSquare1 == null || this.isBlockedTo(isoGridSquare1)) {
                        return null;
                    } else if (!isoGridSquare0.isBlockedTo(next) && !isoGridSquare1.isBlockedTo(next)) {
                        isoObject4 = next.getSpecialSolid();
                        return isoObject4 != null ? isoObject4 : null;
                    } else {
                        return null;
                    }
                }
            }
        } else if (next.x > this.x && next.y < this.y) {
            IsoObject isoObject5 = this.getSpecialWall(true);
            if (isoObject5 != null) {
                return isoObject5;
            } else {
                IsoGridSquare isoGridSquare2 = this.getCell().getGridSquare(this.x, this.y - 1, this.z);
                if (isoGridSquare2 != null && !this.isBlockedTo(isoGridSquare2)) {
                    isoObject5 = isoGridSquare2.getSpecialSolid();
                    if (isoObject5 != null) {
                        return isoObject5;
                    }
                }

                IsoGridSquare isoGridSquare3 = this.getCell().getGridSquare(this.x + 1, this.y, this.z);
                if (isoGridSquare3 != null) {
                    isoObject5 = isoGridSquare3.getSpecialWall(false);
                    if (isoObject5 != null) {
                        return isoObject5;
                    }

                    if (!this.isBlockedTo(isoGridSquare3)) {
                        isoObject5 = isoGridSquare3.getSpecialSolid();
                        if (isoObject5 != null) {
                            return isoObject5;
                        }

                        isoObject5 = isoGridSquare3.getSpecialWall(true);
                        if (isoObject5 != null) {
                            return isoObject5;
                        }
                    }
                }

                if (isoGridSquare2 != null && !this.isBlockedTo(isoGridSquare2) && isoGridSquare3 != null && !this.isBlockedTo(isoGridSquare3)) {
                    isoObject5 = next.getSpecialWall(false);
                    if (isoObject5 != null) {
                        return isoObject5;
                    } else if (!isoGridSquare2.isBlockedTo(next) && !isoGridSquare3.isBlockedTo(next)) {
                        isoObject5 = next.getSpecialSolid();
                        return isoObject5 != null ? isoObject5 : null;
                    } else {
                        return null;
                    }
                } else {
                    return null;
                }
            }
        } else if (next.x > this.x && next.y > this.y) {
            IsoGridSquare isoGridSquare4 = this.getCell().getGridSquare(this.x, this.y + 1, this.z);
            if (isoGridSquare4 != null) {
                IsoObject isoObject6 = isoGridSquare4.getSpecialWall(true);
                if (isoObject6 != null) {
                    return isoObject6;
                }

                if (!this.isBlockedTo(isoGridSquare4)) {
                    isoObject6 = isoGridSquare4.getSpecialSolid();
                    if (isoObject6 != null) {
                        return isoObject6;
                    }
                }
            }

            IsoGridSquare isoGridSquare5 = this.getCell().getGridSquare(this.x + 1, this.y, this.z);
            if (isoGridSquare5 != null) {
                IsoObject isoObject7 = isoGridSquare5.getSpecialWall(false);
                if (isoObject7 != null) {
                    return isoObject7;
                }

                if (!this.isBlockedTo(isoGridSquare5)) {
                    isoObject7 = isoGridSquare5.getSpecialSolid();
                    if (isoObject7 != null) {
                        return isoObject7;
                    }
                }
            }

            if (isoGridSquare4 != null && !this.isBlockedTo(isoGridSquare4) && isoGridSquare5 != null && !this.isBlockedTo(isoGridSquare5)) {
                IsoObject isoObject8 = next.getSpecialWall(false);
                if (isoObject8 != null) {
                    return isoObject8;
                } else {
                    isoObject8 = next.getSpecialWall(true);
                    if (isoObject8 != null) {
                        return isoObject8;
                    } else if (!isoGridSquare4.isBlockedTo(next) && !isoGridSquare5.isBlockedTo(next)) {
                        isoObject8 = next.getSpecialSolid();
                        return isoObject8 != null ? isoObject8 : null;
                    } else {
                        return null;
                    }
                }
            } else {
                return null;
            }
        } else if (next.x < this.x && next.y > this.y) {
            IsoObject isoObject9 = this.getSpecialWall(false);
            if (isoObject9 != null) {
                return isoObject9;
            } else {
                IsoGridSquare isoGridSquare6 = this.getCell().getGridSquare(this.x, this.y + 1, this.z);
                if (isoGridSquare6 != null) {
                    isoObject9 = isoGridSquare6.getSpecialWall(true);
                    if (isoObject9 != null) {
                        return isoObject9;
                    }

                    if (!this.isBlockedTo(isoGridSquare6)) {
                        isoObject9 = isoGridSquare6.getSpecialSolid();
                        if (isoObject9 != null) {
                            return isoObject9;
                        }
                    }
                }

                IsoGridSquare isoGridSquare7 = this.getCell().getGridSquare(this.x - 1, this.y, this.z);
                if (isoGridSquare7 != null && !this.isBlockedTo(isoGridSquare7)) {
                    isoObject9 = isoGridSquare7.getSpecialSolid();
                    if (isoObject9 != null) {
                        return isoObject9;
                    }
                }

                if (isoGridSquare6 != null && !this.isBlockedTo(isoGridSquare6) && isoGridSquare7 != null && !this.isBlockedTo(isoGridSquare7)) {
                    isoObject9 = next.getSpecialWall(true);
                    if (isoObject9 != null) {
                        return isoObject9;
                    } else if (!isoGridSquare6.isBlockedTo(next) && !isoGridSquare7.isBlockedTo(next)) {
                        isoObject9 = next.getSpecialSolid();
                        return isoObject9 != null ? isoObject9 : null;
                    } else {
                        return null;
                    }
                } else {
                    return null;
                }
            }
        } else {
            return null;
        }
    }

    public IsoObject getDoorFrameTo(IsoGridSquare next) {
        ArrayList arrayList = null;
        if (next.y >= this.y && next.x >= this.x) {
            arrayList = next.SpecialObjects;
        } else {
            arrayList = this.SpecialObjects;
        }

        for (int _int = 0; _int < arrayList.size(); _int++) {
            if (arrayList.get(_int) instanceof IsoDoor) {
                IsoDoor isoDoor = (IsoDoor)arrayList.get(_int);
                boolean boolean0 = isoDoor.north;
                if (boolean0 && next.y != this.y) {
                    return isoDoor;
                }

                if (!boolean0 && next.x != this.x) {
                    return isoDoor;
                }
            } else if (arrayList.get(_int) instanceof IsoThumpable && ((IsoThumpable)arrayList.get(_int)).isDoor) {
                IsoThumpable isoThumpable = (IsoThumpable)arrayList.get(_int);
                boolean boolean1 = isoThumpable.north;
                if (boolean1 && next.y != this.y) {
                    return isoThumpable;
                }

                if (!boolean1 && next.x != this.x) {
                    return isoThumpable;
                }
            }
        }

        return null;
    }

    public static void getSquaresForThread(ArrayDeque<IsoGridSquare> isoGridSquareCacheDest, int count) {
        for (int _int = 0; _int < count; _int++) {
            IsoGridSquare isoGridSquare = (IsoGridSquare)isoGridSquareCache.poll();
            if (isoGridSquare == null) {
                isoGridSquareCacheDest.add(new IsoGridSquare(null, null, 0, 0, 0));
            } else {
                isoGridSquareCacheDest.add(isoGridSquare);
            }
        }
    }

    public static IsoGridSquare getNew(IsoCell cell, SliceY slice, int _x, int _y, int _z) {
        IsoGridSquare isoGridSquare = (IsoGridSquare)isoGridSquareCache.poll();
        if (isoGridSquare == null) {
            return new IsoGridSquare(cell, slice, _x, _y, _z);
        } else {
            isoGridSquare.x = _x;
            isoGridSquare.y = _y;
            isoGridSquare.z = _z;
            isoGridSquare.CachedScreenValue = -1;
            col = 0;
            path = 0;
            pathdoor = 0;
            vision = 0;
            isoGridSquare.collideMatrix = 134217727;
            isoGridSquare.pathMatrix = 134217727;
            isoGridSquare.visionMatrix = 0;
            return isoGridSquare;
        }
    }

    public static IsoGridSquare getNew(ArrayDeque<IsoGridSquare> _isoGridSquareCache, IsoCell cell, SliceY slice, int _x, int _y, int _z) {
        IsoGridSquare isoGridSquare = null;
        if (_isoGridSquareCache.isEmpty()) {
            return new IsoGridSquare(cell, slice, _x, _y, _z);
        } else {
            isoGridSquare = (IsoGridSquare)_isoGridSquareCache.pop();
            isoGridSquare.x = _x;
            isoGridSquare.y = _y;
            isoGridSquare.z = _z;
            isoGridSquare.CachedScreenValue = -1;
            col = 0;
            path = 0;
            pathdoor = 0;
            vision = 0;
            isoGridSquare.collideMatrix = 134217727;
            isoGridSquare.pathMatrix = 134217727;
            isoGridSquare.visionMatrix = 0;
            return isoGridSquare;
        }
    }

    @Deprecated
    public long getHashCodeObjects() {
        this.recalcHashCodeObjects();
        return this.hashCodeObjects;
    }

    @Deprecated
    public int getHashCodeObjectsInt() {
        this.recalcHashCodeObjects();
        return (int)this.hashCodeObjects;
    }

    @Deprecated
    public void recalcHashCodeObjects() {
        long _long = 0L;
        this.hashCodeObjects = _long;
    }

    @Deprecated
    public int hashCodeNoOverride() {
        int int0 = 0;
        this.recalcHashCodeObjects();
        int0 = int0 * 2 + this.Objects.size();
        int0 = (int)((long)int0 + this.getHashCodeObjects());

        for (int int1 = 0; int1 < this.Objects.size(); int1++) {
            int0 = int0 * 2 + this.Objects.get(int1).hashCode();
        }

        int int2 = 0;

        for (int int3 = 0; int3 < this.StaticMovingObjects.size(); int3++) {
            if (this.StaticMovingObjects.get(int3) instanceof IsoDeadBody) {
                int2++;
            }
        }

        int0 = int0 * 2 + int2;

        for (int int4 = 0; int4 < this.StaticMovingObjects.size(); int4++) {
            IsoMovingObject isoMovingObject = (IsoMovingObject)this.StaticMovingObjects.get(int4);
            if (isoMovingObject instanceof IsoDeadBody) {
                int0 = int0 * 2 + isoMovingObject.hashCode();
            }
        }

        if (this.table != null && !this.table.isEmpty()) {
            int0 = int0 * 2 + this.table.hashCode();
        }

        byte _byte = 0;
        if (this.isOverlayDone()) {
            _byte = (byte)(_byte | 1);
        }

        if (this.haveRoof) {
            _byte = (byte)(_byte | 2);
        }

        if (this.burntOut) {
            _byte = (byte)(_byte | 4);
        }

        int0 = int0 * 2 + _byte;
        int0 = int0 * 2 + this.getErosionData().hashCode();
        if (this.getTrapPositionX() > 0) {
            int0 = int0 * 2 + this.getTrapPositionX();
            int0 = int0 * 2 + this.getTrapPositionY();
            int0 = int0 * 2 + this.getTrapPositionZ();
        }

        int0 = int0 * 2 + (this.haveElectricity() ? 1 : 0);
        return int0 * 2 + (this.haveSheetRope ? 1 : 0);
    }

    public IsoGridSquare(IsoCell cell, SliceY slice, int _x, int _y, int _z) {
        this.ID = ++IDMax;
        this.x = _x;
        this.y = _y;
        this.z = _z;
        this.CachedScreenValue = -1;
        col = 0;
        path = 0;
        pathdoor = 0;
        vision = 0;
        this.collideMatrix = 134217727;
        this.pathMatrix = 134217727;
        this.visionMatrix = 0;

        for (int _int = 0; _int < 4; _int++) {
            if (GameServer.bServer) {
                if (_int == 0) {
                    this.lighting[_int] = new ServerLOS.ServerLighting();
                }
            } else if (LightingJNI.init) {
                this.lighting[_int] = new LightingJNI.JNILighting(_int, this);
            } else {
                this.lighting[_int] = new IsoGridSquare.Lighting();
            }
        }
    }

    public IsoGridSquare getTileInDirection(IsoDirections directions) {
        if (directions == IsoDirections.N) {
            return this.getCell().getGridSquare(this.x, this.y - 1, this.z);
        } else if (directions == IsoDirections.NE) {
            return this.getCell().getGridSquare(this.x + 1, this.y - 1, this.z);
        } else if (directions == IsoDirections.NW) {
            return this.getCell().getGridSquare(this.x - 1, this.y - 1, this.z);
        } else if (directions == IsoDirections.E) {
            return this.getCell().getGridSquare(this.x + 1, this.y, this.z);
        } else if (directions == IsoDirections.W) {
            return this.getCell().getGridSquare(this.x - 1, this.y, this.z);
        } else if (directions == IsoDirections.SE) {
            return this.getCell().getGridSquare(this.x + 1, this.y + 1, this.z);
        } else if (directions == IsoDirections.SW) {
            return this.getCell().getGridSquare(this.x - 1, this.y + 1, this.z);
        } else {
            return directions == IsoDirections.S ? this.getCell().getGridSquare(this.x, this.y + 1, this.z) : null;
        }
    }

    IsoObject getWall() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject != null && isoObject.sprite != null && (isoObject.sprite.cutW || isoObject.sprite.cutN)) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getThumpableWall(boolean bNorth) {
        IsoObject isoObject = this.getWall(bNorth);
        return isoObject != null && isoObject instanceof IsoThumpable ? isoObject : null;
    }

    public IsoObject getHoppableWall(boolean bNorth) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject != null && isoObject.sprite != null) {
                PropertyContainer propertyContainer = isoObject.getProperties();
                boolean boolean0 = propertyContainer.Is(IsoFlagType.TallHoppableW) && !propertyContainer.Is(IsoFlagType.WallWTrans);
                boolean boolean1 = propertyContainer.Is(IsoFlagType.TallHoppableN) && !propertyContainer.Is(IsoFlagType.WallNTrans);
                if (boolean0 && !bNorth || boolean1 && bNorth) {
                    return isoObject;
                }
            }
        }

        return null;
    }

    public IsoObject getThumpableWallOrHoppable(boolean bNorth) {
        IsoObject isoObject0 = this.getThumpableWall(bNorth);
        IsoObject isoObject1 = this.getHoppableWall(bNorth);
        if (isoObject0 != null && isoObject1 != null && isoObject0 == isoObject1) {
            return isoObject0;
        } else if (isoObject0 == null && isoObject1 != null) {
            return isoObject1;
        } else {
            return isoObject0 != null && isoObject1 == null ? isoObject0 : null;
        }
    }

    public Boolean getWallFull() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject != null
                && isoObject.sprite != null
                && (
                    isoObject.sprite.cutN
                        || isoObject.sprite.cutW
                        || isoObject.sprite.getProperties().Is(IsoFlagType.WallN)
                        || isoObject.sprite.getProperties().Is(IsoFlagType.WallW)
                )) {
                return true;
            }
        }

        return false;
    }

    public IsoObject getWall(boolean bNorth) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject != null && isoObject.sprite != null && (isoObject.sprite.cutN && bNorth || isoObject.sprite.cutW && !bNorth)) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getWallSE() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject != null && isoObject.sprite != null && isoObject.sprite.getProperties().Is(IsoFlagType.WallSE)) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getFloor() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject.sprite != null && isoObject.sprite.getProperties().Is(IsoFlagType.solidfloor)) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getPlayerBuiltFloor() {
        return this.getBuilding() == null && this.roofHideBuilding == null ? this.getFloor() : null;
    }

    public void interpolateLight(ColorInfo inf, float _x, float _y) {
        IsoCell isoCell = this.getCell();
        if (_x < 0.0F) {
            _x = 0.0F;
        }

        if (_x > 1.0F) {
            _x = 1.0F;
        }

        if (_y < 0.0F) {
            _y = 0.0F;
        }

        if (_y > 1.0F) {
            _y = 1.0F;
        }

        int int0 = IsoCamera.frameState.playerIndex;
        int int1 = this.getVertLight(0, int0);
        int int2 = this.getVertLight(1, int0);
        int int3 = this.getVertLight(2, int0);
        int int4 = this.getVertLight(3, int0);
        tl.fromColor(int1);
        bl.fromColor(int4);
        tr.fromColor(int2);
        br.fromColor(int3);
        tl.interp(tr, _x, interp1);
        bl.interp(br, _x, interp2);
        interp1.interp(interp2, _y, finalCol);
        inf.r = finalCol.r;
        inf.g = finalCol.g;
        inf.b = finalCol.b;
        inf.a = finalCol.a;
    }

    public void EnsureSurroundNotNull() {
        assert !GameServer.bServer;

        for (int int0 = -1; int0 <= 1; int0++) {
            for (int int1 = -1; int1 <= 1; int1++) {
                if ((int0 != 0 || int1 != 0)
                    && IsoWorld.instance.isValidSquare(this.x + int0, this.y + int1, this.z)
                    && this.getCell().getChunkForGridSquare(this.x + int0, this.y + int1, this.z) != null) {
                    IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(this.x + int0, this.y + int1, this.z);
                    if (isoGridSquare1 == null) {
                        isoGridSquare1 = getNew(this.getCell(), null, this.x + int0, this.y + int1, this.z);
                        IsoGridSquare isoGridSquare2 = this.getCell().ConnectNewSquare(isoGridSquare1, false);
                    }
                }
            }
        }
    }

    public IsoObject addFloor(String sprite) {
        IsoRegions.setPreviousFlags(this);
        IsoObject isoObject0 = new IsoObject(this.getCell(), this, sprite);
        boolean _boolean = false;

        for (int int0 = 0; int0 < this.getObjects().size(); int0++) {
            IsoObject isoObject1 = this.getObjects().get(int0);
            IsoSprite isoSprite = isoObject1.sprite;
            if (isoSprite != null
                && (
                    isoSprite.getProperties().Is(IsoFlagType.solidfloor)
                        || isoSprite.getProperties().Is(IsoFlagType.noStart)
                        || isoSprite.getProperties().Is(IsoFlagType.vegitation) && isoObject1.getType() != IsoObjectType.tree
                        || isoSprite.getName() != null && isoSprite.getName().startsWith("blends_grassoverlays")
                )) {
                if (isoSprite.getName() != null && isoSprite.getName().startsWith("floors_rugs")) {
                    _boolean = true;
                } else {
                    this.transmitRemoveItemFromSquare(isoObject1);
                    int0--;
                }
            }
        }

        isoObject0.sprite.getProperties().Set(IsoFlagType.solidfloor);
        if (_boolean) {
            this.getObjects().add(0, isoObject0);
        } else {
            this.getObjects().add(isoObject0);
        }

        this.EnsureSurroundNotNull();
        this.RecalcProperties();
        this.getCell().checkHaveRoof(this.x, this.y);

        for (int int1 = 0; int1 < IsoPlayer.numPlayers; int1++) {
            LosUtil.cachecleared[int1] = true;
        }

        setRecalcLightTime(-1);
        zombie.GameTime.getInstance().lightSourceUpdate = 100.0F;
        isoObject0.transmitCompleteItemToServer();
        this.RecalcAllWithNeighbours(true);

        for (int int2 = this.z - 1; int2 > 0; int2--) {
            IsoGridSquare isoGridSquare = this.getCell().getGridSquare(this.x, this.y, int2);
            if (isoGridSquare == null) {
                isoGridSquare = getNew(this.getCell(), null, this.x, this.y, int2);
                this.getCell().ConnectNewSquare(isoGridSquare, false);
            }

            isoGridSquare.EnsureSurroundNotNull();
            isoGridSquare.RecalcAllWithNeighbours(true);
        }

        this.setCachedIsFree(false);
        PolygonalMap2.instance.squareChanged(this);
        IsoGridOcclusionData.SquareChanged();
        IsoRegions.squareChanged(this);
        this.clearWater();
        return isoObject0;
    }

    public IsoThumpable AddStairs(boolean boolean1, int int0, String string0, String string1, KahluaTable kahluaTable) {
        IsoRegions.setPreviousFlags(this);
        this.EnsureSurroundNotNull();
        boolean boolean0 = !this.TreatAsSolidFloor() && !this.HasStairsBelow();
        this.CachedIsFree = false;
        IsoThumpable isoThumpable0 = new IsoThumpable(this.getCell(), this, string0, boolean1, kahluaTable);
        if (boolean1) {
            if (int0 == 0) {
                isoThumpable0.setType(IsoObjectType.stairsBN);
            }

            if (int0 == 1) {
                isoThumpable0.setType(IsoObjectType.stairsMN);
            }

            if (int0 == 2) {
                isoThumpable0.setType(IsoObjectType.stairsTN);
                isoThumpable0.sprite.getProperties().Set(boolean1 ? IsoFlagType.cutN : IsoFlagType.cutW);
            }
        }

        if (!boolean1) {
            if (int0 == 0) {
                isoThumpable0.setType(IsoObjectType.stairsBW);
            }

            if (int0 == 1) {
                isoThumpable0.setType(IsoObjectType.stairsMW);
            }

            if (int0 == 2) {
                isoThumpable0.setType(IsoObjectType.stairsTW);
                isoThumpable0.sprite.getProperties().Set(boolean1 ? IsoFlagType.cutN : IsoFlagType.cutW);
            }
        }

        this.AddSpecialObject(isoThumpable0);
        if (boolean0 && int0 == 2) {
            int int1 = this.z - 1;
            IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(this.x, this.y, int1);
            if (isoGridSquare1 == null) {
                isoGridSquare1 = new IsoGridSquare(this.getCell(), null, this.x, this.y, int1);
                this.getCell().ConnectNewSquare(isoGridSquare1, true);
            }

            while (int1 >= 0) {
                IsoThumpable isoThumpable1 = new IsoThumpable(this.getCell(), isoGridSquare1, string1, boolean1, kahluaTable);
                isoGridSquare1.AddSpecialObject(isoThumpable1);
                isoThumpable1.transmitCompleteItemToServer();
                if (isoGridSquare1.TreatAsSolidFloor()) {
                    break;
                }

                if (this.getCell().getGridSquare(isoGridSquare1.x, isoGridSquare1.y, --int1) == null) {
                    isoGridSquare1 = new IsoGridSquare(this.getCell(), null, isoGridSquare1.x, isoGridSquare1.y, int1);
                    this.getCell().ConnectNewSquare(isoGridSquare1, true);
                } else {
                    isoGridSquare1 = this.getCell().getGridSquare(isoGridSquare1.x, isoGridSquare1.y, int1);
                }
            }
        }

        if (int0 == 2) {
            IsoGridSquare isoGridSquare2 = null;
            if (boolean1) {
                if (IsoWorld.instance.isValidSquare(this.x, this.y - 1, this.z + 1)) {
                    isoGridSquare2 = this.getCell().getGridSquare(this.x, this.y - 1, this.z + 1);
                    if (isoGridSquare2 == null) {
                        isoGridSquare2 = new IsoGridSquare(this.getCell(), null, this.x, this.y - 1, this.z + 1);
                        this.getCell().ConnectNewSquare(isoGridSquare2, false);
                    }

                    if (!isoGridSquare2.Properties.Is(IsoFlagType.solidfloor)) {
                        isoGridSquare2.addFloor("carpentry_02_57");
                    }
                }
            } else if (IsoWorld.instance.isValidSquare(this.x - 1, this.y, this.z + 1)) {
                isoGridSquare2 = this.getCell().getGridSquare(this.x - 1, this.y, this.z + 1);
                if (isoGridSquare2 == null) {
                    isoGridSquare2 = new IsoGridSquare(this.getCell(), null, this.x - 1, this.y, this.z + 1);
                    this.getCell().ConnectNewSquare(isoGridSquare2, false);
                }

                if (!isoGridSquare2.Properties.Is(IsoFlagType.solidfloor)) {
                    isoGridSquare2.addFloor("carpentry_02_57");
                }
            }

            isoGridSquare2.getModData().rawset("ConnectedToStairs" + boolean1, true);
            isoGridSquare2 = this.getCell().getGridSquare(this.x, this.y, this.z + 1);
            if (isoGridSquare2 == null) {
                isoGridSquare2 = new IsoGridSquare(this.getCell(), null, this.x, this.y, this.z + 1);
                this.getCell().ConnectNewSquare(isoGridSquare2, false);
            }
        }

        for (int int2 = this.getX() - 1; int2 <= this.getX() + 1; int2++) {
            for (int int3 = this.getY() - 1; int3 <= this.getY() + 1; int3++) {
                for (int int4 = this.getZ() - 1; int4 <= this.getZ() + 1; int4++) {
                    if (IsoWorld.instance.isValidSquare(int2, int3, int4)) {
                        IsoGridSquare isoGridSquare3 = this.getCell().getGridSquare(int2, int3, int4);
                        if (isoGridSquare3 == null) {
                            isoGridSquare3 = new IsoGridSquare(this.getCell(), null, int2, int3, int4);
                            this.getCell().ConnectNewSquare(isoGridSquare3, false);
                        }

                        isoGridSquare3.ReCalculateCollide(this);
                        isoGridSquare3.ReCalculateVisionBlocked(this);
                        isoGridSquare3.ReCalculatePathFind(this);
                        this.ReCalculateCollide(isoGridSquare3);
                        this.ReCalculatePathFind(isoGridSquare3);
                        this.ReCalculateVisionBlocked(isoGridSquare3);
                        isoGridSquare3.CachedIsFree = false;
                    }
                }
            }
        }

        return isoThumpable0;
    }

    void ReCalculateAll(IsoGridSquare isoGridSquare1) {
        this.ReCalculateAll(isoGridSquare1, cellGetSquare);
    }

    void ReCalculateAll(IsoGridSquare isoGridSquare0, IsoGridSquare.GetSquare getSquare) {
        if (isoGridSquare0 != null && isoGridSquare0 != this) {
            this.SolidFloorCached = false;
            isoGridSquare0.SolidFloorCached = false;
            this.RecalcPropertiesIfNeeded();
            isoGridSquare0.RecalcPropertiesIfNeeded();
            this.ReCalculateCollide(isoGridSquare0, getSquare);
            isoGridSquare0.ReCalculateCollide(this, getSquare);
            this.ReCalculatePathFind(isoGridSquare0, getSquare);
            isoGridSquare0.ReCalculatePathFind(this, getSquare);
            this.ReCalculateVisionBlocked(isoGridSquare0, getSquare);
            isoGridSquare0.ReCalculateVisionBlocked(this, getSquare);
            this.setBlockedGridPointers(getSquare);
            isoGridSquare0.setBlockedGridPointers(getSquare);
        }
    }

    void ReCalculateAll(boolean _boolean, IsoGridSquare isoGridSquare0, IsoGridSquare.GetSquare getSquare) {
        if (isoGridSquare0 != null && isoGridSquare0 != this) {
            this.SolidFloorCached = false;
            isoGridSquare0.SolidFloorCached = false;
            this.RecalcPropertiesIfNeeded();
            if (_boolean) {
                isoGridSquare0.RecalcPropertiesIfNeeded();
            }

            this.ReCalculateCollide(isoGridSquare0, getSquare);
            if (_boolean) {
                isoGridSquare0.ReCalculateCollide(this, getSquare);
            }

            this.ReCalculatePathFind(isoGridSquare0, getSquare);
            if (_boolean) {
                isoGridSquare0.ReCalculatePathFind(this, getSquare);
            }

            this.ReCalculateVisionBlocked(isoGridSquare0, getSquare);
            if (_boolean) {
                isoGridSquare0.ReCalculateVisionBlocked(this, getSquare);
            }

            this.setBlockedGridPointers(getSquare);
            if (_boolean) {
                isoGridSquare0.setBlockedGridPointers(getSquare);
            }
        }
    }

    void ReCalculateMineOnly(IsoGridSquare isoGridSquare1) {
        this.SolidFloorCached = false;
        this.RecalcProperties();
        this.ReCalculateCollide(isoGridSquare1);
        this.ReCalculatePathFind(isoGridSquare1);
        this.ReCalculateVisionBlocked(isoGridSquare1);
        this.setBlockedGridPointers(cellGetSquare);
    }

    public void RecalcAllWithNeighbours(boolean bDoReverse) {
        this.RecalcAllWithNeighbours(bDoReverse, cellGetSquare);
    }

    public void RecalcAllWithNeighbours(boolean bDoReverse, IsoGridSquare.GetSquare getter) {
        this.SolidFloorCached = false;
        this.RecalcPropertiesIfNeeded();

        for (int int0 = this.getX() - 1; int0 <= this.getX() + 1; int0++) {
            for (int int1 = this.getY() - 1; int1 <= this.getY() + 1; int1++) {
                for (int int2 = this.getZ() - 1; int2 <= this.getZ() + 1; int2++) {
                    if (IsoWorld.instance.isValidSquare(int0, int1, int2)) {
                        int int3 = int0 - this.getX();
                        int int4 = int1 - this.getY();
                        int int5 = int2 - this.getZ();
                        if (int3 != 0 || int4 != 0 || int5 != 0) {
                            IsoGridSquare isoGridSquare0 = getter.getGridSquare(int0, int1, int2);
                            if (isoGridSquare0 != null) {
                                isoGridSquare0.DirtySlice();
                                this.ReCalculateAll(bDoReverse, isoGridSquare0, getter);
                            }
                        }
                    }
                }
            }
        }

        IsoWorld.instance.CurrentCell.DoGridNav(this, getter);
        IsoGridSquare isoGridSquare1 = this.nav[IsoDirections.N.index()];
        IsoGridSquare isoGridSquare2 = this.nav[IsoDirections.S.index()];
        IsoGridSquare isoGridSquare3 = this.nav[IsoDirections.W.index()];
        IsoGridSquare isoGridSquare4 = this.nav[IsoDirections.E.index()];
        if (isoGridSquare1 != null && isoGridSquare3 != null) {
            isoGridSquare1.ReCalculateAll(isoGridSquare3, getter);
        }

        if (isoGridSquare1 != null && isoGridSquare4 != null) {
            isoGridSquare1.ReCalculateAll(isoGridSquare4, getter);
        }

        if (isoGridSquare2 != null && isoGridSquare3 != null) {
            isoGridSquare2.ReCalculateAll(isoGridSquare3, getter);
        }

        if (isoGridSquare2 != null && isoGridSquare4 != null) {
            isoGridSquare2.ReCalculateAll(isoGridSquare4, getter);
        }
    }

    public void RecalcAllWithNeighboursMineOnly() {
        this.SolidFloorCached = false;
        this.RecalcProperties();

        for (int int0 = this.getX() - 1; int0 <= this.getX() + 1; int0++) {
            for (int int1 = this.getY() - 1; int1 <= this.getY() + 1; int1++) {
                for (int int2 = this.getZ() - 1; int2 <= this.getZ() + 1; int2++) {
                    if (int2 >= 0) {
                        int int3 = int0 - this.getX();
                        int int4 = int1 - this.getY();
                        int int5 = int2 - this.getZ();
                        if (int3 != 0 || int4 != 0 || int5 != 0) {
                            IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(int0, int1, int2);
                            if (isoGridSquare1 != null) {
                                isoGridSquare1.DirtySlice();
                                this.ReCalculateMineOnly(isoGridSquare1);
                            }
                        }
                    }
                }
            }
        }
    }

    boolean IsWindow(int int2, int int1, int int0) {
        IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x + int2, this.y + int1, this.z + int0);
        return this.getWindowTo(isoGridSquare0) != null || this.getWindowThumpableTo(isoGridSquare0) != null;
    }

    void RemoveAllWith(IsoFlagType isoFlagType) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject.sprite != null && isoObject.sprite.getProperties().Is(isoFlagType)) {
                this.Objects.remove(isoObject);
                this.SpecialObjects.remove(isoObject);
                _int--;
            }
        }

        this.RecalcAllWithNeighbours(true);
    }

    public boolean hasSupport() {
        IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, this.y + 1, this.z);
        IsoGridSquare isoGridSquare2 = this.getCell().getGridSquare(this.x + 1, this.y, this.z);

        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject.sprite != null
                && (
                    isoObject.sprite.getProperties().Is(IsoFlagType.solid)
                        || (isoObject.sprite.getProperties().Is(IsoFlagType.cutW) || isoObject.sprite.getProperties().Is(IsoFlagType.cutN))
                            && !isoObject.sprite.Properties.Is(IsoFlagType.halfheight)
                )) {
                return true;
            }
        }

        return isoGridSquare0 != null && isoGridSquare0.Properties.Is(IsoFlagType.cutN) && !isoGridSquare0.Properties.Is(IsoFlagType.halfheight)
            ? true
            : isoGridSquare2 != null && isoGridSquare2.Properties.Is(IsoFlagType.cutW) && !isoGridSquare0.Properties.Is(IsoFlagType.halfheight);
    }

    public Integer getID() {
        return this.ID;
    }

    public void setID(int _ID) {
        this.ID = _ID;
    }

    private int savematrix(boolean[][][] _boolean, byte[] _byte, int int3) {
        for (int int0 = 0; int0 <= 2; int0++) {
            for (int int1 = 0; int1 <= 2; int1++) {
                for (int int2 = 0; int2 <= 2; int2++) {
                    _byte[int3] = (byte)(_boolean[int0][int1][int2] ? 1 : 0);
                    int3++;
                }
            }
        }

        return int3;
    }

    private int loadmatrix(boolean[][][] _boolean, byte[] _byte, int int3) {
        for (int int0 = 0; int0 <= 2; int0++) {
            for (int int1 = 0; int1 <= 2; int1++) {
                for (int int2 = 0; int2 <= 2; int2++) {
                    _boolean[int0][int1][int2] = _byte[int3] != 0;
                    int3++;
                }
            }
        }

        return int3;
    }

    private void savematrix(boolean[][][] _boolean, ByteBuffer byteBuffer) {
        for (int int0 = 0; int0 <= 2; int0++) {
            for (int int1 = 0; int1 <= 2; int1++) {
                for (int int2 = 0; int2 <= 2; int2++) {
                    byteBuffer.put((byte)(_boolean[int0][int1][int2] ? 1 : 0));
                }
            }
        }
    }

    private void loadmatrix(boolean[][][] _boolean, ByteBuffer byteBuffer) {
        for (int int0 = 0; int0 <= 2; int0++) {
            for (int int1 = 0; int1 <= 2; int1++) {
                for (int int2 = 0; int2 <= 2; int2++) {
                    _boolean[int0][int1][int2] = byteBuffer.get() != 0;
                }
            }
        }
    }

    public void DirtySlice() {
    }

    public void setHourSeenToCurrent() {
        this.hourLastSeen = (int)zombie.GameTime.instance.getWorldAgeHours();
    }

    public void splatBlood(int dist, float alpha) {
        alpha *= 2.0F;
        alpha *= 3.0F;
        if (alpha > 1.0F) {
            alpha = 1.0F;
        }

        IsoGridSquare isoGridSquare0 = this;
        IsoGridSquare isoGridSquare1 = this;

        for (int int0 = 0; int0 < dist; int0++) {
            if (isoGridSquare0 != null) {
                isoGridSquare0 = this.getCell().getGridSquare(this.getX(), this.getY() - int0, this.getZ());
            }

            if (isoGridSquare1 != null) {
                isoGridSquare1 = this.getCell().getGridSquare(this.getX() - int0, this.getY(), this.getZ());
            }

            float float0 = 0.0F;
            if (isoGridSquare1 != null && isoGridSquare1.testCollideAdjacent(null, -1, 0, 0)) {
                boolean boolean0 = false;
                boolean boolean1 = false;
                byte byte0 = 0;
                byte byte1 = 0;
                if (isoGridSquare1.getS() != null && isoGridSquare1.getS().testCollideAdjacent(null, -1, 0, 0)) {
                    boolean0 = true;
                }

                if (isoGridSquare1.getN() != null && isoGridSquare1.getN().testCollideAdjacent(null, -1, 0, 0)) {
                    boolean1 = true;
                }

                if (boolean0) {
                    byte0 = -1;
                }

                if (boolean1) {
                    byte1 = 1;
                }

                int int1 = byte1 - byte0;
                boolean boolean2 = false;
                byte byte2 = 0;
                byte byte3 = 0;
                if (int1 > 0 && Rand.Next(2) == 0) {
                    boolean2 = true;
                    if (int1 > 1) {
                        if (Rand.Next(2) == 0) {
                            byte2 = -1;
                            byte3 = 0;
                        } else {
                            byte2 = 0;
                            byte3 = 1;
                        }
                    } else {
                        byte2 = byte0;
                        byte3 = byte1;
                    }
                }

                float float1 = (float)Rand.Next(100) / 300.0F;
                IsoGridSquare isoGridSquare2 = this.getCell().getGridSquare(isoGridSquare1.getX(), isoGridSquare1.getY() + byte2, isoGridSquare1.getZ());
                IsoGridSquare isoGridSquare3 = this.getCell().getGridSquare(isoGridSquare1.getX(), isoGridSquare1.getY() + byte3, isoGridSquare1.getZ());
                if (isoGridSquare2 == null
                    || isoGridSquare3 == null
                    || !isoGridSquare2.Is(IsoFlagType.cutW)
                    || !isoGridSquare3.Is(IsoFlagType.cutW)
                    || isoGridSquare2.getProperties().Is(IsoFlagType.WallSE)
                    || isoGridSquare3.getProperties().Is(IsoFlagType.WallSE)
                    || isoGridSquare2.Is(IsoFlagType.HoppableW)
                    || isoGridSquare3.Is(IsoFlagType.HoppableW)) {
                    boolean2 = false;
                }

                if (boolean2) {
                    int int2 = 24 + Rand.Next(2) * 2;
                    if (Rand.Next(2) == 0) {
                        int2 += 8;
                    }

                    isoGridSquare2.DoSplat("overlay_blood_wall_01_" + (int2 + 1), false, IsoFlagType.cutW, float0, float1, alpha);
                    isoGridSquare3.DoSplat("overlay_blood_wall_01_" + (int2 + 0), false, IsoFlagType.cutW, float0, float1, alpha);
                } else {
                    int int3 = 0;
                    switch (Rand.Next(3)) {
                        case 0:
                            int3 = 0 + Rand.Next(4);
                            break;
                        case 1:
                            int3 = 8 + Rand.Next(4);
                            break;
                        case 2:
                            int3 = 16 + Rand.Next(4);
                    }

                    if (int3 == 17 || int3 == 19) {
                        float1 = 0.0F;
                    }

                    if (isoGridSquare1.Is(IsoFlagType.HoppableW)) {
                        isoGridSquare1.DoSplat("overlay_blood_fence_01_" + int3, false, IsoFlagType.HoppableW, float0, 0.0F, alpha);
                    } else {
                        isoGridSquare1.DoSplat("overlay_blood_wall_01_" + int3, false, IsoFlagType.cutW, float0, float1, alpha);
                    }
                }

                isoGridSquare1 = null;
            }

            if (isoGridSquare0 != null && isoGridSquare0.testCollideAdjacent(null, 0, -1, 0)) {
                boolean boolean3 = false;
                boolean boolean4 = false;
                byte byte4 = 0;
                byte byte5 = 0;
                if (isoGridSquare0.getW() != null && isoGridSquare0.getW().testCollideAdjacent(null, 0, -1, 0)) {
                    boolean3 = true;
                }

                if (isoGridSquare0.getE() != null && isoGridSquare0.getE().testCollideAdjacent(null, 0, -1, 0)) {
                    boolean4 = true;
                }

                if (boolean3) {
                    byte4 = -1;
                }

                if (boolean4) {
                    byte5 = 1;
                }

                int int4 = byte5 - byte4;
                boolean boolean5 = false;
                byte byte6 = 0;
                byte byte7 = 0;
                if (int4 > 0 && Rand.Next(2) == 0) {
                    boolean5 = true;
                    if (int4 > 1) {
                        if (Rand.Next(2) == 0) {
                            byte6 = -1;
                            byte7 = 0;
                        } else {
                            byte6 = 0;
                            byte7 = 1;
                        }
                    } else {
                        byte6 = byte4;
                        byte7 = byte5;
                    }
                }

                float float2 = (float)Rand.Next(100) / 300.0F;
                IsoGridSquare isoGridSquare4 = this.getCell().getGridSquare(isoGridSquare0.getX() + byte6, isoGridSquare0.getY(), isoGridSquare0.getZ());
                IsoGridSquare isoGridSquare5 = this.getCell().getGridSquare(isoGridSquare0.getX() + byte7, isoGridSquare0.getY(), isoGridSquare0.getZ());
                if (isoGridSquare4 == null
                    || isoGridSquare5 == null
                    || !isoGridSquare4.Is(IsoFlagType.cutN)
                    || !isoGridSquare5.Is(IsoFlagType.cutN)
                    || isoGridSquare4.getProperties().Is(IsoFlagType.WallSE)
                    || isoGridSquare5.getProperties().Is(IsoFlagType.WallSE)
                    || isoGridSquare4.Is(IsoFlagType.HoppableN)
                    || isoGridSquare5.Is(IsoFlagType.HoppableN)) {
                    boolean5 = false;
                }

                if (boolean5) {
                    int int5 = 28 + Rand.Next(2) * 2;
                    if (Rand.Next(2) == 0) {
                        int5 += 8;
                    }

                    isoGridSquare4.DoSplat("overlay_blood_wall_01_" + (int5 + 0), false, IsoFlagType.cutN, float0, float2, alpha);
                    isoGridSquare5.DoSplat("overlay_blood_wall_01_" + (int5 + 1), false, IsoFlagType.cutN, float0, float2, alpha);
                } else {
                    int int6 = 0;
                    switch (Rand.Next(3)) {
                        case 0:
                            int6 = 4 + Rand.Next(4);
                            break;
                        case 1:
                            int6 = 12 + Rand.Next(4);
                            break;
                        case 2:
                            int6 = 20 + Rand.Next(4);
                    }

                    if (int6 == 20 || int6 == 22) {
                        float2 = 0.0F;
                    }

                    if (isoGridSquare0.Is(IsoFlagType.HoppableN)) {
                        isoGridSquare0.DoSplat("overlay_blood_fence_01_" + int6, false, IsoFlagType.HoppableN, float0, float2, alpha);
                    } else {
                        isoGridSquare0.DoSplat("overlay_blood_wall_01_" + int6, false, IsoFlagType.cutN, float0, float2, alpha);
                    }
                }

                isoGridSquare0 = null;
            }
        }
    }

    public boolean haveBlood() {
        if (Core.OptionBloodDecals == 0) {
            return false;
        } else {
            for (int int0 = 0; int0 < this.getObjects().size(); int0++) {
                IsoObject isoObject = this.getObjects().get(int0);
                if (isoObject.wallBloodSplats != null && !isoObject.wallBloodSplats.isEmpty()) {
                    return true;
                }
            }

            for (int int1 = 0; int1 < this.getChunk().FloorBloodSplats.size(); int1++) {
                IsoFloorBloodSplat isoFloorBloodSplat = this.getChunk().FloorBloodSplats.get(int1);
                float float0 = isoFloorBloodSplat.x + (float)(this.getChunk().wx * 10);
                float float1 = isoFloorBloodSplat.y + (float)(this.getChunk().wy * 10);
                if ((int)float0 - 1 <= this.x && (int)float0 + 1 >= this.x && (int)float1 - 1 <= this.y && (int)float1 + 1 >= this.y) {
                    return true;
                }
            }

            return false;
        }
    }

    public void removeBlood(boolean remote, boolean onlyWall) {
        for (int int0 = 0; int0 < this.getObjects().size(); int0++) {
            IsoObject isoObject = this.getObjects().get(int0);
            if (isoObject.wallBloodSplats != null) {
                isoObject.wallBloodSplats.clear();
            }
        }

        if (!onlyWall) {
            for (int int1 = 0; int1 < this.getChunk().FloorBloodSplats.size(); int1++) {
                IsoFloorBloodSplat isoFloorBloodSplat = this.getChunk().FloorBloodSplats.get(int1);
                int int2 = (int)((float)(this.getChunk().wx * 10) + isoFloorBloodSplat.x);
                int int3 = (int)((float)(this.getChunk().wy * 10) + isoFloorBloodSplat.y);
                if (int2 >= this.getX() - 1 && int2 <= this.getX() + 1 && int3 >= this.getY() - 1 && int3 <= this.getY() + 1) {
                    this.getChunk().FloorBloodSplats.remove(int1);
                    int1--;
                }
            }
        }

        if (GameClient.bClient && !remote) {
            ByteBufferWriter byteBufferWriter = GameClient.connection.startPacket();
            PacketTypes.PacketType.RemoveBlood.doPacket(byteBufferWriter);
            byteBufferWriter.putInt(this.x);
            byteBufferWriter.putInt(this.y);
            byteBufferWriter.putInt(this.z);
            byteBufferWriter.putBoolean(onlyWall);
            PacketTypes.PacketType.RemoveBlood.send(GameClient.connection);
        }
    }

    public void DoSplat(String id, boolean bFlip, IsoFlagType prop, float offX, float offZ, float alpha) {
        for (int _int = 0; _int < this.getObjects().size(); _int++) {
            IsoObject isoObject = this.getObjects().get(_int);
            if (isoObject.sprite != null && isoObject.sprite.getProperties().Is(prop) && (!(isoObject instanceof IsoWindow) || !isoObject.isDestroyed())) {
                IsoSprite isoSprite = IsoSprite.getSprite(IsoSpriteManager.instance, id, 0);
                if (isoSprite == null) {
                    return;
                }

                if (isoObject.wallBloodSplats == null) {
                    isoObject.wallBloodSplats = new ArrayList();
                }

                IsoWallBloodSplat isoWallBloodSplat = new IsoWallBloodSplat((float)zombie.GameTime.getInstance().getWorldAgeHours(), isoSprite);
                isoObject.wallBloodSplats.add(isoWallBloodSplat);
            }
        }
    }

    public void ClearTileObjects() {
        this.Objects.clear();
        this.RecalcProperties();
    }

    public void ClearTileObjectsExceptFloor() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject.sprite == null || !isoObject.sprite.getProperties().Is(IsoFlagType.solidfloor)) {
                this.Objects.remove(isoObject);
                _int--;
            }
        }

        this.RecalcProperties();
    }

    public int RemoveTileObject(IsoObject obj) {
        IsoRegions.setPreviousFlags(this);
        int int0 = this.Objects.indexOf(obj);
        if (!this.Objects.contains(obj)) {
            int0 = this.SpecialObjects.indexOf(obj);
        }

        if (obj != null && this.Objects.contains(obj)) {
            if (obj.isTableSurface()) {
                for (int int1 = this.Objects.indexOf(obj) + 1; int1 < this.Objects.size(); int1++) {
                    IsoObject isoObject0 = this.Objects.get(int1);
                    if (isoObject0.isTableTopObject() || isoObject0.isTableSurface()) {
                        isoObject0.setRenderYOffset(isoObject0.getRenderYOffset() - obj.getSurfaceOffset());
                        isoObject0.sx = 0.0F;
                        isoObject0.sy = 0.0F;
                    }
                }
            }

            IsoObject isoObject1 = this.getPlayerBuiltFloor();
            if (obj == isoObject1) {
                IsoGridOcclusionData.SquareChanged();
            }

            LuaEventManager.triggerEvent("OnObjectAboutToBeRemoved", obj);
            if (!this.Objects.contains(obj)) {
                throw new IllegalArgumentException("OnObjectAboutToBeRemoved not allowed to remove the object");
            }

            int0 = this.Objects.indexOf(obj);
            obj.removeFromWorld();
            obj.removeFromSquare();

            assert !this.Objects.contains(obj);

            assert !this.SpecialObjects.contains(obj);

            if (!(obj instanceof IsoWorldInventoryObject)) {
                this.RecalcAllWithNeighbours(true);
                this.getCell().checkHaveRoof(this.getX(), this.getY());

                for (int int2 = 0; int2 < IsoPlayer.numPlayers; int2++) {
                    LosUtil.cachecleared[int2] = true;
                }

                setRecalcLightTime(-1);
                zombie.GameTime.instance.lightSourceUpdate = 100.0F;
            }

            this.fixPlacedItemRenderOffsets();
        }

        zombie.MapCollisionData.instance.squareChanged(this);
        LuaEventManager.triggerEvent("OnTileRemoved", obj);
        PolygonalMap2.instance.squareChanged(this);
        IsoRegions.squareChanged(this, true);
        return int0;
    }

    public int RemoveTileObjectErosionNoRecalc(IsoObject obj) {
        int _int = this.Objects.indexOf(obj);
        IsoGridSquare isoGridSquare = obj.square;
        obj.removeFromWorld();
        obj.removeFromSquare();
        isoGridSquare.RecalcPropertiesIfNeeded();

        assert !this.Objects.contains(obj);

        assert !this.SpecialObjects.contains(obj);

        return _int;
    }

    public void AddSpecialObject(IsoObject obj) {
        this.AddSpecialObject(obj, -1);
    }

    public void AddSpecialObject(IsoObject obj, int index) {
        if (obj != null) {
            IsoRegions.setPreviousFlags(this);
            index = this.placeWallAndDoorCheck(obj, index);
            if (index != -1 && index >= 0 && index <= this.Objects.size()) {
                this.Objects.add(index, obj);
            } else {
                this.Objects.add(obj);
            }

            this.SpecialObjects.add(obj);
            this.burntOut = false;
            obj.addToWorld();
            if (!GameServer.bServer && !GameClient.bClient) {
                this.restackSheetRope();
            }

            this.RecalcAllWithNeighbours(true);
            this.fixPlacedItemRenderOffsets();
            if (!(obj instanceof IsoWorldInventoryObject)) {
                for (int _int = 0; _int < IsoPlayer.numPlayers; _int++) {
                    LosUtil.cachecleared[_int] = true;
                }

                setRecalcLightTime(-1);
                zombie.GameTime.instance.lightSourceUpdate = 100.0F;
                if (obj == this.getPlayerBuiltFloor()) {
                    IsoGridOcclusionData.SquareChanged();
                }
            }

            zombie.MapCollisionData.instance.squareChanged(this);
            PolygonalMap2.instance.squareChanged(this);
            IsoRegions.squareChanged(this);
        }
    }

    public void AddTileObject(IsoObject obj) {
        this.AddTileObject(obj, -1);
    }

    public void AddTileObject(IsoObject obj, int index) {
        if (obj != null) {
            IsoRegions.setPreviousFlags(this);
            index = this.placeWallAndDoorCheck(obj, index);
            if (index != -1 && index >= 0 && index <= this.Objects.size()) {
                this.Objects.add(index, obj);
            } else {
                this.Objects.add(obj);
            }

            this.burntOut = false;
            obj.addToWorld();
            this.RecalcAllWithNeighbours(true);
            this.fixPlacedItemRenderOffsets();
            if (!(obj instanceof IsoWorldInventoryObject)) {
                for (int _int = 0; _int < IsoPlayer.numPlayers; _int++) {
                    LosUtil.cachecleared[_int] = true;
                }

                setRecalcLightTime(-1);
                zombie.GameTime.instance.lightSourceUpdate = 100.0F;
                if (obj == this.getPlayerBuiltFloor()) {
                    IsoGridOcclusionData.SquareChanged();
                }
            }

            zombie.MapCollisionData.instance.squareChanged(this);
            PolygonalMap2.instance.squareChanged(this);
            IsoRegions.squareChanged(this);
        }
    }

    public int placeWallAndDoorCheck(IsoObject obj, int index) {
        int int0 = -1;
        if (obj.sprite != null) {
            IsoObjectType isoObjectType = obj.sprite.getType();
            boolean boolean0 = isoObjectType == IsoObjectType.doorN || isoObjectType == IsoObjectType.doorW;
            boolean boolean1 = !boolean0
                && (
                    obj.sprite.cutW
                        || obj.sprite.cutN
                        || isoObjectType == IsoObjectType.doorFrN
                        || isoObjectType == IsoObjectType.doorFrW
                        || obj.sprite.treatAsWallOrder
                );
            if (boolean1 || boolean0) {
                for (int int1 = 0; int1 < this.Objects.size(); int1++) {
                    IsoObject isoObject = this.Objects.get(int1);
                    isoObjectType = IsoObjectType.MAX;
                    if (isoObject.sprite != null) {
                        isoObjectType = isoObject.sprite.getType();
                        if (boolean1 && (isoObjectType == IsoObjectType.doorN || isoObjectType == IsoObjectType.doorW)) {
                            int0 = int1;
                        }

                        if (boolean0
                            && (
                                isoObjectType == IsoObjectType.doorFrN
                                    || isoObjectType == IsoObjectType.doorFrW
                                    || isoObject.sprite.cutW
                                    || isoObject.sprite.cutN
                                    || isoObject.sprite.treatAsWallOrder
                            )) {
                            int0 = int1;
                        }
                    }
                }

                if (boolean0 && int0 > index) {
                    return int0 + 1;
                }

                if (boolean1 && int0 >= 0 && (int0 < index || index < 0)) {
                    return int0;
                }
            }
        }

        return index;
    }

    public void transmitAddObjectToSquare(IsoObject obj, int index) {
        if (obj != null && !this.Objects.contains(obj)) {
            this.AddTileObject(obj, index);
            if (GameClient.bClient) {
                obj.transmitCompleteItemToServer();
            }

            if (GameServer.bServer) {
                obj.transmitCompleteItemToClients();
            }
        }
    }

    public int transmitRemoveItemFromSquare(IsoObject obj) {
        if (obj != null && this.Objects.contains(obj)) {
            if (GameClient.bClient) {
                try {
                    GameClient.instance.checkAddedRemovedItems(obj);
                } catch (Exception exception) {
                    GameClient.connection.cancelPacket();
                    ExceptionLogger.logException(exception);
                }

                ByteBufferWriter byteBufferWriter = GameClient.connection.startPacket();
                PacketTypes.PacketType.RemoveItemFromSquare.doPacket(byteBufferWriter);
                byteBufferWriter.putInt(this.getX());
                byteBufferWriter.putInt(this.getY());
                byteBufferWriter.putInt(this.getZ());
                byteBufferWriter.putInt(this.Objects.indexOf(obj));
                PacketTypes.PacketType.RemoveItemFromSquare.send(GameClient.connection);
            }

            return GameServer.bServer ? GameServer.RemoveItemFromMap(obj) : this.RemoveTileObject(obj);
        } else {
            return -1;
        }
    }

    public void transmitRemoveItemFromSquareOnServer(IsoObject obj) {
        if (obj != null && this.Objects.contains(obj)) {
            if (GameServer.bServer) {
                GameServer.RemoveItemFromMap(obj);
            }
        }
    }

    public void transmitModdata() {
        if (GameClient.bClient) {
            ByteBufferWriter byteBufferWriter = GameClient.connection.startPacket();
            PacketTypes.PacketType.SendModData.doPacket(byteBufferWriter);
            byteBufferWriter.putInt(this.getX());
            byteBufferWriter.putInt(this.getY());
            byteBufferWriter.putInt(this.getZ());

            try {
                this.getModData().save(byteBufferWriter.bb);
            } catch (IOException iOException) {
                iOException.printStackTrace();
            }

            PacketTypes.PacketType.SendModData.send(GameClient.connection);
        } else if (GameServer.bServer) {
            GameServer.loadModData(this);
        }
    }

    public void AddWorldInventoryItem(String String, float _x, float _y, float height, int nbr) {
        for (int _int = 0; _int < nbr; _int++) {
            this.AddWorldInventoryItem(String, _x, _y, height);
        }
    }

    public InventoryItem AddWorldInventoryItem(String String, float _x, float _y, float height) {
        InventoryItem inventoryItem = InventoryItemFactory.CreateItem(String);
        if (inventoryItem == null) {
            return null;
        } else {
            IsoWorldInventoryObject isoWorldInventoryObject = new IsoWorldInventoryObject(inventoryItem, this, _x, _y, height);
            inventoryItem.setAutoAge();
            inventoryItem.setWorldItem(isoWorldInventoryObject);
            isoWorldInventoryObject.setKeyId(inventoryItem.getKeyId());
            isoWorldInventoryObject.setName(inventoryItem.getName());
            this.Objects.add(isoWorldInventoryObject);
            this.WorldObjects.add(isoWorldInventoryObject);
            isoWorldInventoryObject.square.chunk.recalcHashCodeObjects();
            if (GameClient.bClient) {
                isoWorldInventoryObject.transmitCompleteItemToServer();
            }

            if (GameServer.bServer) {
                isoWorldInventoryObject.transmitCompleteItemToClients();
            }

            return inventoryItem;
        }
    }

    public InventoryItem AddWorldInventoryItem(InventoryItem item, float _x, float _y, float height) {
        return this.AddWorldInventoryItem(item, _x, _y, height, true);
    }

    public InventoryItem AddWorldInventoryItem(InventoryItem item, float _x, float _y, float height, boolean transmit) {
        if (!item.getFullType().contains(".Corpse")) {
            if (item.getFullType().contains(".Generator")) {
                new IsoGenerator(item, IsoWorld.instance.CurrentCell, this);
                return item;
            } else {
                IsoWorldInventoryObject isoWorldInventoryObject = new IsoWorldInventoryObject(item, this, _x, _y, height);
                isoWorldInventoryObject.setName(item.getName());
                isoWorldInventoryObject.setKeyId(item.getKeyId());
                this.Objects.add(isoWorldInventoryObject);
                this.WorldObjects.add(isoWorldInventoryObject);
                isoWorldInventoryObject.square.chunk.recalcHashCodeObjects();
                item.setWorldItem(isoWorldInventoryObject);
                isoWorldInventoryObject.addToWorld();
                if (transmit) {
                    if (GameClient.bClient) {
                        isoWorldInventoryObject.transmitCompleteItemToServer();
                    }

                    if (GameServer.bServer) {
                        isoWorldInventoryObject.transmitCompleteItemToClients();
                    }
                }

                return item;
            }
        } else if (item.byteData == null) {
            IsoZombie isoZombie0 = new IsoZombie(IsoWorld.instance.CurrentCell);
            isoZombie0.setDir(IsoDirections.fromIndex(Rand.Next(8)));
            isoZombie0.getForwardDirection().set(isoZombie0.dir.ToVector());
            isoZombie0.setFakeDead(false);
            isoZombie0.setHealth(0.0F);
            isoZombie0.upKillCount = false;
            isoZombie0.setX((float)this.x + _x);
            isoZombie0.setY((float)this.y + _y);
            isoZombie0.setZ((float)this.z);
            isoZombie0.square = this;
            isoZombie0.current = this;
            isoZombie0.dressInRandomOutfit();
            isoZombie0.DoZombieInventory();
            IsoDeadBody isoDeadBody0 = new IsoDeadBody(isoZombie0, true);
            this.addCorpse(isoDeadBody0, false);
            if (GameServer.bServer) {
                GameServer.sendCorpse(isoDeadBody0);
            }

            return item;
        } else {
            IsoDeadBody isoDeadBody1 = new IsoDeadBody(IsoWorld.instance.CurrentCell);

            try {
                byte byte0 = item.byteData.get();
                byte byte1 = item.byteData.get();
                byte byte2 = item.byteData.get();
                byte byte3 = item.byteData.get();
                int _int = 56;
                if (byte0 == 87 && byte1 == 86 && byte2 == 69 && byte3 == 82) {
                    _int = item.byteData.getInt();
                } else {
                    item.byteData.rewind();
                }

                isoDeadBody1.load(item.byteData, _int);
            } catch (IOException iOException) {
                iOException.printStackTrace();
                IsoZombie isoZombie1 = new IsoZombie(null);
                isoZombie1.dir = isoDeadBody1.dir;
                isoZombie1.current = this;
                isoZombie1.x = isoDeadBody1.x;
                isoZombie1.y = isoDeadBody1.y;
                isoZombie1.z = isoDeadBody1.z;
                isoDeadBody1 = new IsoDeadBody(isoZombie1);
            }

            isoDeadBody1.setX((float)this.x + _x);
            isoDeadBody1.setY((float)this.y + _y);
            isoDeadBody1.setZ((float)this.z);
            isoDeadBody1.square = this;
            this.addCorpse(isoDeadBody1, false);
            if (GameServer.bServer) {
                GameServer.sendCorpse(isoDeadBody1);
            }

            return item;
        }
    }

    public void restackSheetRope() {
        if (this.Is(IsoFlagType.climbSheetW) || this.Is(IsoFlagType.climbSheetN) || this.Is(IsoFlagType.climbSheetE) || this.Is(IsoFlagType.climbSheetS)) {
            for (int _int = 0; _int < this.getObjects().size() - 1; _int++) {
                IsoObject isoObject = this.getObjects().get(_int);
                if (isoObject.getProperties() != null
                    && (
                        isoObject.getProperties().Is(IsoFlagType.climbSheetW)
                            || isoObject.getProperties().Is(IsoFlagType.climbSheetN)
                            || isoObject.getProperties().Is(IsoFlagType.climbSheetE)
                            || isoObject.getProperties().Is(IsoFlagType.climbSheetS)
                    )) {
                    if (GameServer.bServer) {
                        this.transmitRemoveItemFromSquare(isoObject);
                        this.Objects.add(isoObject);
                        isoObject.transmitCompleteItemToClients();
                    } else if (!GameClient.bClient) {
                        this.Objects.remove(isoObject);
                        this.Objects.add(isoObject);
                    }
                    break;
                }
            }
        }
    }

    public void Burn() {
        if (!GameServer.bServer && !GameClient.bClient || !ServerOptions.instance.NoFire.getValue()) {
            if (this.getCell() != null) {
                this.BurnWalls(true);
                LuaEventManager.triggerEvent("OnGridBurnt", this);
            }
        }
    }

    public void Burn(boolean explode) {
        if (!GameServer.bServer && !GameClient.bClient || !ServerOptions.instance.NoFire.getValue()) {
            if (this.getCell() != null) {
                this.BurnWalls(explode);
            }
        }
    }

    public void BurnWalls(boolean explode) {
        if (!GameClient.bClient) {
            if (GameServer.bServer && SafeHouse.isSafeHouse(this, null, false) != null) {
                if (ServerOptions.instance.NoFire.getValue()) {
                    return;
                }

                if (!ServerOptions.instance.SafehouseAllowFire.getValue()) {
                    return;
                }
            }

            for (int int0 = 0; int0 < this.SpecialObjects.size(); int0++) {
                IsoObject isoObject0 = (IsoObject)this.SpecialObjects.get(int0);
                if (isoObject0 instanceof IsoThumpable && ((IsoThumpable)isoObject0).haveSheetRope()) {
                    ((IsoThumpable)isoObject0).removeSheetRope(null);
                }

                if (isoObject0 instanceof IsoWindow) {
                    if (((IsoWindow)isoObject0).haveSheetRope()) {
                        ((IsoWindow)isoObject0).removeSheetRope(null);
                    }

                    ((IsoWindow)isoObject0).removeSheet(null);
                }

                if (IsoWindowFrame.isWindowFrame(isoObject0) && IsoWindowFrame.haveSheetRope(isoObject0)) {
                    IsoWindowFrame.removeSheetRope(isoObject0, null);
                }

                if (isoObject0 instanceof BarricadeAble) {
                    IsoBarricade isoBarricade0 = ((BarricadeAble)isoObject0).getBarricadeOnSameSquare();
                    IsoBarricade isoBarricade1 = ((BarricadeAble)isoObject0).getBarricadeOnOppositeSquare();
                    if (isoBarricade0 != null) {
                        if (GameServer.bServer) {
                            GameServer.RemoveItemFromMap(isoBarricade0);
                        } else {
                            this.RemoveTileObject(isoBarricade0);
                        }
                    }

                    if (isoBarricade1 != null) {
                        if (GameServer.bServer) {
                            GameServer.RemoveItemFromMap(isoBarricade1);
                        } else {
                            isoBarricade1.getSquare().RemoveTileObject(isoBarricade1);
                        }
                    }
                }
            }

            this.SpecialObjects.clear();
            boolean boolean0 = false;
            if (!this.getProperties().Is(IsoFlagType.burntOut)) {
                byte _byte = 0;

                for (int int1 = 0; int1 < this.Objects.size(); int1++) {
                    IsoObject isoObject1 = this.Objects.get(int1);
                    boolean boolean1 = false;
                    if (isoObject1.getSprite() != null
                        && isoObject1.getSprite().getName() != null
                        && !isoObject1.getSprite().getProperties().Is(IsoFlagType.water)
                        && !isoObject1.getSprite().getName().contains("_burnt_")) {
                        if (isoObject1 instanceof IsoThumpable && isoObject1.getSprite().burntTile != null) {
                            IsoObject isoObject2 = IsoObject.getNew();
                            isoObject2.setSprite(IsoSpriteManager.instance.getSprite(isoObject1.getSprite().burntTile));
                            isoObject2.setSquare(this);
                            if (GameServer.bServer) {
                                isoObject1.sendObjectChange("replaceWith", "object", isoObject2);
                            }

                            isoObject1.removeFromWorld();
                            this.Objects.set(int1, isoObject2);
                        } else if (isoObject1.getSprite().burntTile != null) {
                            isoObject1.sprite = IsoSpriteManager.instance.getSprite(isoObject1.getSprite().burntTile);
                            isoObject1.RemoveAttachedAnims();
                            if (isoObject1.Children != null) {
                                isoObject1.Children.clear();
                            }

                            isoObject1.transmitUpdatedSpriteToClients();
                            isoObject1.setOverlaySprite(null);
                        } else if (isoObject1.getType() == IsoObjectType.tree) {
                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("fencing_burnt_01_" + (Rand.Next(15, 19) + 1));
                            isoObject1.RemoveAttachedAnims();
                            if (isoObject1.Children != null) {
                                isoObject1.Children.clear();
                            }

                            isoObject1.transmitUpdatedSpriteToClients();
                            isoObject1.setOverlaySprite(null);
                        } else if (!(isoObject1 instanceof IsoTrap)) {
                            if (!(isoObject1 instanceof IsoBarricade) && !(isoObject1 instanceof IsoMannequin)) {
                                if (isoObject1 instanceof IsoGenerator) {
                                    IsoGenerator isoGenerator = (IsoGenerator)isoObject1;
                                    if (isoGenerator.getFuel() > 0.0F) {
                                        _byte += 20;
                                    }

                                    if (isoGenerator.isActivated()) {
                                        isoGenerator.activated = false;
                                        isoGenerator.setSurroundingElectricity();
                                        if (GameServer.bServer) {
                                            isoGenerator.syncIsoObject(false, (byte)0, null, null);
                                        }
                                    }

                                    if (GameServer.bServer) {
                                        GameServer.RemoveItemFromMap(isoObject1);
                                    } else {
                                        this.RemoveTileObject(isoObject1);
                                    }

                                    int1--;
                                } else {
                                    if (isoObject1.getType() == IsoObjectType.wall
                                        && !isoObject1.getProperties().Is(IsoFlagType.DoorWallW)
                                        && !isoObject1.getProperties().Is(IsoFlagType.DoorWallN)
                                        && !isoObject1.getProperties().Is("WindowN")
                                        && !isoObject1.getProperties().Is(IsoFlagType.WindowW)
                                        && !isoObject1.getSprite().getName().startsWith("walls_exterior_roofs_")
                                        && !isoObject1.getSprite().getName().startsWith("fencing_")
                                        && !isoObject1.getSprite().getName().startsWith("fixtures_railings_")) {
                                        if (isoObject1.getSprite().getProperties().Is(IsoFlagType.collideW)
                                            && !isoObject1.getSprite().getProperties().Is(IsoFlagType.collideN)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "0" : "4"));
                                        } else if (isoObject1.getSprite().getProperties().Is(IsoFlagType.collideN)
                                            && !isoObject1.getSprite().getProperties().Is(IsoFlagType.collideW)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "1" : "5"));
                                        } else if (isoObject1.getSprite().getProperties().Is(IsoFlagType.collideW)
                                            && isoObject1.getSprite().getProperties().Is(IsoFlagType.collideN)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "2" : "6"));
                                        } else if (isoObject1.getProperties().Is(IsoFlagType.WallSE)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "3" : "7"));
                                        }
                                    } else {
                                        if (isoObject1 instanceof IsoDoor || isoObject1 instanceof IsoWindow || isoObject1 instanceof IsoCurtain) {
                                            if (GameServer.bServer) {
                                                GameServer.RemoveItemFromMap(isoObject1);
                                            } else {
                                                this.RemoveTileObject(isoObject1);
                                                boolean0 = true;
                                            }

                                            int1--;
                                            continue;
                                        }

                                        if (isoObject1.getProperties().Is(IsoFlagType.WindowW)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "8" : "12"));
                                        } else if (isoObject1.getProperties().Is("WindowN")) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "9" : "13"));
                                        } else if (isoObject1.getProperties().Is(IsoFlagType.DoorWallW)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "10" : "14"));
                                        } else if (isoObject1.getProperties().Is(IsoFlagType.DoorWallN)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("walls_burnt_01_" + (Rand.Next(2) == 0 ? "11" : "15"));
                                        } else if (isoObject1.getSprite().getProperties().Is(IsoFlagType.solidfloor)
                                            && !isoObject1.getSprite().getProperties().Is(IsoFlagType.exterior)) {
                                            isoObject1.sprite = IsoSpriteManager.instance.getSprite("floors_burnt_01_0");
                                        } else {
                                            if (isoObject1 instanceof IsoWaveSignal) {
                                                if (GameServer.bServer) {
                                                    GameServer.RemoveItemFromMap(isoObject1);
                                                } else {
                                                    this.RemoveTileObject(isoObject1);
                                                    boolean0 = true;
                                                }

                                                int1--;
                                                continue;
                                            }

                                            if (isoObject1.getContainer() != null && isoObject1.getContainer().getItems() != null) {
                                                Object object = null;

                                                for (int int2 = 0; int2 < isoObject1.getContainer().getItems().size(); int2++) {
                                                    object = (InventoryItem)isoObject1.getContainer().getItems().get(int2);
                                                    if (object instanceof Food && ((Food)object).isAlcoholic()
                                                        || ((InventoryItem)object).getType().equals("PetrolCan")
                                                        || ((InventoryItem)object).getType().equals("Bleach")) {
                                                        _byte += 20;
                                                        if (_byte > 100) {
                                                            _byte = 100;
                                                            break;
                                                        }
                                                    }
                                                }

                                                isoObject1.sprite = IsoSpriteManager.instance.getSprite("floors_burnt_01_" + Rand.Next(1, 2));

                                                for (int int3 = 0; int3 < isoObject1.getContainerCount(); int3++) {
                                                    ItemContainer itemContainer = isoObject1.getContainerByIndex(int3);
                                                    itemContainer.removeItemsFromProcessItems();
                                                    itemContainer.removeAllItems();
                                                }

                                                isoObject1.removeAllContainers();
                                                if (isoObject1.getOverlaySprite() != null) {
                                                    isoObject1.setOverlaySprite(null);
                                                }

                                                boolean1 = true;
                                            } else if (isoObject1.getSprite().getProperties().Is(IsoFlagType.solidtrans)
                                                || isoObject1.getSprite().getProperties().Is(IsoFlagType.bed)
                                                || isoObject1.getSprite().getProperties().Is(IsoFlagType.waterPiped)) {
                                                isoObject1.sprite = IsoSpriteManager.instance.getSprite("floors_burnt_01_" + Rand.Next(1, 2));
                                                if (isoObject1.getOverlaySprite() != null) {
                                                    isoObject1.setOverlaySprite(null);
                                                }
                                            } else if (isoObject1.getSprite().getName().startsWith("walls_exterior_roofs_")) {
                                                isoObject1.sprite = IsoSpriteManager.instance
                                                    .getSprite(
                                                        "walls_burnt_roofs_01_"
                                                            + isoObject1.getSprite()
                                                                .getName()
                                                                .substring(
                                                                    isoObject1.getSprite().getName().lastIndexOf("_") + 1,
                                                                    isoObject1.getSprite().getName().length()
                                                                )
                                                    );
                                            } else if (!isoObject1.getSprite().getName().startsWith("roofs_accents")) {
                                                if (isoObject1.getSprite().getName().startsWith("roofs_")) {
                                                    isoObject1.sprite = IsoSpriteManager.instance
                                                        .getSprite(
                                                            "roofs_burnt_01_"
                                                                + isoObject1.getSprite()
                                                                    .getName()
                                                                    .substring(
                                                                        isoObject1.getSprite().getName().lastIndexOf("_") + 1,
                                                                        isoObject1.getSprite().getName().length()
                                                                    )
                                                        );
                                                } else if ((
                                                        isoObject1.getSprite().getName().startsWith("fencing_")
                                                            || isoObject1.getSprite().getName().startsWith("fixtures_railings_")
                                                    )
                                                    && (
                                                        isoObject1.getSprite().getProperties().Is(IsoFlagType.HoppableN)
                                                            || isoObject1.getSprite().getProperties().Is(IsoFlagType.HoppableW)
                                                    )) {
                                                    if (isoObject1.getSprite().getProperties().Is(IsoFlagType.transparentW)
                                                        && !isoObject1.getSprite().getProperties().Is(IsoFlagType.transparentN)) {
                                                        isoObject1.sprite = IsoSpriteManager.instance.getSprite("fencing_burnt_01_0");
                                                    } else if (isoObject1.getSprite().getProperties().Is(IsoFlagType.transparentN)
                                                        && !isoObject1.getSprite().getProperties().Is(IsoFlagType.transparentW)) {
                                                        isoObject1.sprite = IsoSpriteManager.instance.getSprite("fencing_burnt_01_1");
                                                    } else {
                                                        isoObject1.sprite = IsoSpriteManager.instance.getSprite("fencing_burnt_01_2");
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    if (!boolean1 && !(isoObject1 instanceof IsoThumpable)) {
                                        isoObject1.RemoveAttachedAnims();
                                        isoObject1.transmitUpdatedSpriteToClients();
                                        isoObject1.setOverlaySprite(null);
                                    } else {
                                        IsoObject isoObject3 = IsoObject.getNew();
                                        isoObject3.setSprite(isoObject1.getSprite());
                                        isoObject3.setSquare(this);
                                        if (GameServer.bServer) {
                                            isoObject1.sendObjectChange("replaceWith", "object", isoObject3);
                                        }

                                        this.Objects.set(int1, isoObject3);
                                    }

                                    if (isoObject1.emitter != null) {
                                        isoObject1.emitter.stopAll();
                                        isoObject1.emitter = null;
                                    }
                                }
                            } else {
                                if (GameServer.bServer) {
                                    GameServer.RemoveItemFromMap(isoObject1);
                                } else {
                                    this.Objects.remove(isoObject1);
                                }

                                int1--;
                            }
                        }
                    }
                }

                if (_byte > 0 && explode) {
                    if (GameServer.bServer) {
                        GameServer.PlayWorldSoundServer("BurnedObjectExploded", false, this, 0.0F, 50.0F, 1.0F, false);
                    } else {
                        zombie.SoundManager.instance.PlayWorldSound("BurnedObjectExploded", this, 0.0F, 50.0F, 1.0F, false);
                    }

                    IsoFireManager.explode(this.getCell(), this, _byte);
                }
            }

            if (!boolean0) {
                this.RecalcProperties();
            }

            this.getProperties().Set(IsoFlagType.burntOut);
            this.burntOut = true;
            zombie.MapCollisionData.instance.squareChanged(this);
            PolygonalMap2.instance.squareChanged(this);
        }
    }

    public void BurnWallsTCOnly() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject.sprite == null) {
            }
        }
    }

    public void BurnTick() {
        if (!GameClient.bClient) {
            for (int _int = 0; _int < this.StaticMovingObjects.size(); _int++) {
                IsoMovingObject isoMovingObject = (IsoMovingObject)this.StaticMovingObjects.get(_int);
                if (isoMovingObject instanceof IsoDeadBody) {
                    ((IsoDeadBody)isoMovingObject).Burn();
                    if (!this.StaticMovingObjects.contains(isoMovingObject)) {
                        _int--;
                    }
                }
            }
        }
    }

    public boolean CalculateCollide(IsoGridSquare gridSquare, boolean bVision, boolean bPathfind, boolean bIgnoreSolidTrans) {
        return this.CalculateCollide(gridSquare, bVision, bPathfind, bIgnoreSolidTrans, false);
    }

    public boolean CalculateCollide(IsoGridSquare gridSquare, boolean bVision, boolean bPathfind, boolean bIgnoreSolidTrans, boolean bIgnoreSolid) {
        return this.CalculateCollide(gridSquare, bVision, bPathfind, bIgnoreSolidTrans, bIgnoreSolid, cellGetSquare);
    }

    public boolean CalculateCollide(
        IsoGridSquare gridSquare, boolean bVision, boolean bPathfind, boolean bIgnoreSolidTrans, boolean bIgnoreSolid, IsoGridSquare.GetSquare getter
    ) {
        if (gridSquare == null && bPathfind) {
            return true;
        } else if (gridSquare == null) {
            return false;
        } else {
            if (bVision && gridSquare.Properties.Is(IsoFlagType.trans)) {
            }

            boolean boolean0 = false;
            boolean boolean1 = false;
            boolean boolean2 = false;
            boolean boolean3 = false;
            if (gridSquare.x < this.x) {
                boolean0 = true;
            }

            if (gridSquare.y < this.y) {
                boolean2 = true;
            }

            if (gridSquare.x > this.x) {
                boolean1 = true;
            }

            if (gridSquare.y > this.y) {
                boolean3 = true;
            }

            if (!bIgnoreSolid && gridSquare.Properties.Is(IsoFlagType.solid)) {
                return this.Has(IsoObjectType.stairsTW) && !bPathfind && gridSquare.x < this.x && gridSquare.y == this.y && gridSquare.z == this.z
                    ? false
                    : !this.Has(IsoObjectType.stairsTN) || bPathfind || gridSquare.x != this.x || gridSquare.y >= this.y || gridSquare.z != this.z;
            } else {
                if (!bIgnoreSolidTrans && gridSquare.Properties.Is(IsoFlagType.solidtrans)) {
                    if (this.Has(IsoObjectType.stairsTW) && !bPathfind && gridSquare.x < this.x && gridSquare.y == this.y && gridSquare.z == this.z) {
                        return false;
                    }

                    if (this.Has(IsoObjectType.stairsTN) && !bPathfind && gridSquare.x == this.x && gridSquare.y < this.y && gridSquare.z == this.z) {
                        return false;
                    }

                    boolean boolean4 = false;
                    if (gridSquare.Properties.Is(IsoFlagType.windowW) || gridSquare.Properties.Is(IsoFlagType.windowN)) {
                        boolean4 = true;
                    }

                    if (!boolean4 && (gridSquare.Properties.Is(IsoFlagType.WindowW) || gridSquare.Properties.Is(IsoFlagType.WindowN))) {
                        boolean4 = true;
                    }

                    if (!boolean4) {
                        IsoGridSquare isoGridSquare0 = getter.getGridSquare(gridSquare.x, gridSquare.y + 1, this.z);
                        if (isoGridSquare0 != null && (isoGridSquare0.Is(IsoFlagType.windowN) || isoGridSquare0.Is(IsoFlagType.WindowN))) {
                            boolean4 = true;
                        }
                    }

                    if (!boolean4) {
                        IsoGridSquare isoGridSquare1 = getter.getGridSquare(gridSquare.x + 1, gridSquare.y, this.z);
                        if (isoGridSquare1 != null && (isoGridSquare1.Is(IsoFlagType.windowW) || isoGridSquare1.Is(IsoFlagType.WindowW))) {
                            boolean4 = true;
                        }
                    }

                    if (!boolean4) {
                        return true;
                    }
                }

                if (gridSquare.x != this.x && gridSquare.y != this.y && this.z != gridSquare.z && bPathfind) {
                    return true;
                } else if (!bPathfind || gridSquare.z >= this.z || (this.SolidFloorCached ? this.SolidFloor : this.TreatAsSolidFloor())) {
                    if (bPathfind && gridSquare.z == this.z) {
                        if (gridSquare.x > this.x && gridSquare.y == this.y && gridSquare.Properties.Is(IsoFlagType.windowW)) {
                            return false;
                        }

                        if (gridSquare.y > this.y && gridSquare.x == this.x && gridSquare.Properties.Is(IsoFlagType.windowN)) {
                            return false;
                        }

                        if (gridSquare.x < this.x && gridSquare.y == this.y && this.Properties.Is(IsoFlagType.windowW)) {
                            return false;
                        }

                        if (gridSquare.y < this.y && gridSquare.x == this.x && this.Properties.Is(IsoFlagType.windowN)) {
                            return false;
                        }
                    }

                    if (gridSquare.x > this.x && gridSquare.z < this.z && gridSquare.Has(IsoObjectType.stairsTW)) {
                        return false;
                    } else if (gridSquare.y > this.y && gridSquare.z < this.z && gridSquare.Has(IsoObjectType.stairsTN)) {
                        return false;
                    } else {
                        IsoGridSquare isoGridSquare2 = getter.getGridSquare(gridSquare.x, gridSquare.y, gridSquare.z - 1);
                        if (gridSquare.x == this.x
                            || gridSquare.z != this.z
                            || !gridSquare.Has(IsoObjectType.stairsTN)
                            || isoGridSquare2 != null && isoGridSquare2.Has(IsoObjectType.stairsTN) && !bPathfind) {
                            if (gridSquare.y <= this.y
                                || gridSquare.x != this.x
                                || gridSquare.z != this.z
                                || !gridSquare.Has(IsoObjectType.stairsTN)
                                || isoGridSquare2 != null && isoGridSquare2.Has(IsoObjectType.stairsTN) && !bPathfind) {
                                if (gridSquare.x <= this.x
                                    || gridSquare.y != this.y
                                    || gridSquare.z != this.z
                                    || !gridSquare.Has(IsoObjectType.stairsTW)
                                    || isoGridSquare2 != null && isoGridSquare2.Has(IsoObjectType.stairsTW) && !bPathfind) {
                                    if (gridSquare.y == this.y
                                        || gridSquare.z != this.z
                                        || !gridSquare.Has(IsoObjectType.stairsTW)
                                        || isoGridSquare2 != null && isoGridSquare2.Has(IsoObjectType.stairsTW) && !bPathfind) {
                                        if (gridSquare.x != this.x && gridSquare.z == this.z && gridSquare.Has(IsoObjectType.stairsMN)) {
                                            return true;
                                        } else if (gridSquare.y != this.y && gridSquare.z == this.z && gridSquare.Has(IsoObjectType.stairsMW)) {
                                            return true;
                                        } else if (gridSquare.x != this.x && gridSquare.z == this.z && gridSquare.Has(IsoObjectType.stairsBN)) {
                                            return true;
                                        } else if (gridSquare.y != this.y && gridSquare.z == this.z && gridSquare.Has(IsoObjectType.stairsBW)) {
                                            return true;
                                        } else if (gridSquare.x != this.x && gridSquare.z == this.z && this.Has(IsoObjectType.stairsTN)) {
                                            return true;
                                        } else if (gridSquare.y != this.y && gridSquare.z == this.z && this.Has(IsoObjectType.stairsTW)) {
                                            return true;
                                        } else if (gridSquare.x != this.x && gridSquare.z == this.z && this.Has(IsoObjectType.stairsMN)) {
                                            return true;
                                        } else if (gridSquare.y != this.y && gridSquare.z == this.z && this.Has(IsoObjectType.stairsMW)) {
                                            return true;
                                        } else if (gridSquare.x != this.x && gridSquare.z == this.z && this.Has(IsoObjectType.stairsBN)) {
                                            return true;
                                        } else if (gridSquare.y != this.y && gridSquare.z == this.z && this.Has(IsoObjectType.stairsBW)) {
                                            return true;
                                        } else if (gridSquare.y < this.y && gridSquare.x == this.x && gridSquare.z > this.z && this.Has(IsoObjectType.stairsTN)
                                            )
                                         {
                                            return false;
                                        } else if (gridSquare.x < this.x && gridSquare.y == this.y && gridSquare.z > this.z && this.Has(IsoObjectType.stairsTW)
                                            )
                                         {
                                            return false;
                                        } else if (gridSquare.y > this.y
                                            && gridSquare.x == this.x
                                            && gridSquare.z < this.z
                                            && gridSquare.Has(IsoObjectType.stairsTN)) {
                                            return false;
                                        } else if (gridSquare.x > this.x
                                            && gridSquare.y == this.y
                                            && gridSquare.z < this.z
                                            && gridSquare.Has(IsoObjectType.stairsTW)) {
                                            return false;
                                        } else if (gridSquare.z == this.z
                                            && (gridSquare.SolidFloorCached ? !gridSquare.SolidFloor : !gridSquare.TreatAsSolidFloor())
                                            && bPathfind) {
                                            return true;
                                        } else {
                                            if (gridSquare.z == this.z
                                                && (gridSquare.SolidFloorCached ? !gridSquare.SolidFloor : !gridSquare.TreatAsSolidFloor())
                                                && gridSquare.z > 0) {
                                                isoGridSquare2 = getter.getGridSquare(gridSquare.x, gridSquare.y, gridSquare.z - 1);
                                                if (isoGridSquare2 == null) {
                                                    return true;
                                                }
                                            }

                                            if (this.z == gridSquare.z) {
                                                boolean boolean5 = boolean2 && this.Properties.Is(IsoFlagType.collideN);
                                                boolean boolean6 = boolean0 && this.Properties.Is(IsoFlagType.collideW);
                                                boolean boolean7 = boolean3 && gridSquare.Properties.Is(IsoFlagType.collideN);
                                                boolean boolean8 = boolean1 && gridSquare.Properties.Is(IsoFlagType.collideW);
                                                if (boolean5 && bPathfind && this.Properties.Is(IsoFlagType.canPathN)) {
                                                    boolean5 = false;
                                                }

                                                if (boolean6 && bPathfind && this.Properties.Is(IsoFlagType.canPathW)) {
                                                    boolean6 = false;
                                                }

                                                if (boolean7 && bPathfind && gridSquare.Properties.Is(IsoFlagType.canPathN)) {
                                                    boolean7 = false;
                                                }

                                                if (boolean8 && bPathfind && gridSquare.Properties.Is(IsoFlagType.canPathW)) {
                                                    boolean8 = false;
                                                }

                                                if (boolean6 && this.Has(IsoObjectType.stairsTW) && !bPathfind) {
                                                    boolean6 = false;
                                                }

                                                if (boolean5 && this.Has(IsoObjectType.stairsTN) && !bPathfind) {
                                                    boolean5 = false;
                                                }

                                                if (!boolean5 && !boolean6 && !boolean7 && !boolean8) {
                                                    boolean boolean9 = gridSquare.x != this.x && gridSquare.y != this.y;
                                                    if (boolean9) {
                                                        IsoGridSquare isoGridSquare3 = getter.getGridSquare(this.x, gridSquare.y, this.z);
                                                        IsoGridSquare isoGridSquare4 = getter.getGridSquare(gridSquare.x, this.y, this.z);
                                                        if (isoGridSquare3 != null && isoGridSquare3 != this && isoGridSquare3 != gridSquare) {
                                                            isoGridSquare3.RecalcPropertiesIfNeeded();
                                                        }

                                                        if (isoGridSquare4 != null && isoGridSquare4 != this && isoGridSquare4 != gridSquare) {
                                                            isoGridSquare4.RecalcPropertiesIfNeeded();
                                                        }

                                                        if (gridSquare == this
                                                            || isoGridSquare3 == isoGridSquare4
                                                            || isoGridSquare3 == this
                                                            || isoGridSquare4 == this
                                                            || isoGridSquare3 == gridSquare
                                                            || isoGridSquare4 == gridSquare) {
                                                            return true;
                                                        }

                                                        if (gridSquare.x == this.x + 1
                                                            && gridSquare.y == this.y + 1
                                                            && isoGridSquare3 != null
                                                            && isoGridSquare4 != null
                                                            && isoGridSquare3.Is(IsoFlagType.windowN)
                                                            && isoGridSquare4.Is(IsoFlagType.windowW)) {
                                                            return true;
                                                        }

                                                        if (gridSquare.x == this.x - 1
                                                            && gridSquare.y == this.y - 1
                                                            && isoGridSquare3 != null
                                                            && isoGridSquare4 != null
                                                            && isoGridSquare3.Is(IsoFlagType.windowW)
                                                            && isoGridSquare4.Is(IsoFlagType.windowN)) {
                                                            return true;
                                                        }

                                                        if (this.CalculateCollide(isoGridSquare3, bVision, bPathfind, bIgnoreSolidTrans, false, getter)) {
                                                            return true;
                                                        }

                                                        if (this.CalculateCollide(isoGridSquare4, bVision, bPathfind, bIgnoreSolidTrans, false, getter)) {
                                                            return true;
                                                        }

                                                        if (gridSquare.CalculateCollide(isoGridSquare3, bVision, bPathfind, bIgnoreSolidTrans, false, getter)) {
                                                            return true;
                                                        }

                                                        if (gridSquare.CalculateCollide(isoGridSquare4, bVision, bPathfind, bIgnoreSolidTrans, false, getter)) {
                                                            return true;
                                                        }
                                                    }

                                                    return false;
                                                } else {
                                                    return true;
                                                }
                                            } else {
                                                return gridSquare.z >= this.z
                                                    || gridSquare.x != this.x
                                                    || gridSquare.y != this.y
                                                    || (this.SolidFloorCached ? this.SolidFloor : this.TreatAsSolidFloor());
                                            }
                                        }
                                    } else {
                                        return true;
                                    }
                                } else {
                                    return true;
                                }
                            } else {
                                return true;
                            }
                        } else {
                            return true;
                        }
                    }
                } else {
                    return gridSquare.Has(IsoObjectType.stairsTN) || gridSquare.Has(IsoObjectType.stairsTW);
                }
            }
        }
    }

    public boolean CalculateVisionBlocked(IsoGridSquare gridSquare) {
        return this.CalculateVisionBlocked(gridSquare, cellGetSquare);
    }

    public boolean CalculateVisionBlocked(IsoGridSquare gridSquare, IsoGridSquare.GetSquare getter) {
        if (gridSquare == null) {
            return false;
        } else if (Math.abs(gridSquare.getX() - this.getX()) <= 1 && Math.abs(gridSquare.getY() - this.getY()) <= 1) {
            boolean boolean0 = false;
            boolean boolean1 = false;
            boolean boolean2 = false;
            boolean boolean3 = false;
            if (gridSquare.x < this.x) {
                boolean0 = true;
            }

            if (gridSquare.y < this.y) {
                boolean2 = true;
            }

            if (gridSquare.x > this.x) {
                boolean1 = true;
            }

            if (gridSquare.y > this.y) {
                boolean3 = true;
            }

            if (!gridSquare.Properties.Is(IsoFlagType.trans) && !this.Properties.Is(IsoFlagType.trans)) {
                if (this.z != gridSquare.z) {
                    if (gridSquare.z > this.z) {
                        if ((gridSquare.SolidFloorCached ? gridSquare.SolidFloor : gridSquare.TreatAsSolidFloor())
                            && !gridSquare.getProperties().Is(IsoFlagType.transparentFloor)) {
                            return true;
                        }

                        if (this.Properties.Is(IsoFlagType.noStart)) {
                            return true;
                        }

                        IsoGridSquare isoGridSquare0 = getter.getGridSquare(this.x, this.y, gridSquare.z);
                        if (isoGridSquare0 == null) {
                            return false;
                        }

                        if ((isoGridSquare0.SolidFloorCached ? isoGridSquare0.SolidFloor : isoGridSquare0.TreatAsSolidFloor())
                            && !isoGridSquare0.getProperties().Is(IsoFlagType.transparentFloor)) {
                            return true;
                        }
                    } else {
                        if ((this.SolidFloorCached ? this.SolidFloor : this.TreatAsSolidFloor()) && !this.getProperties().Is(IsoFlagType.transparentFloor)) {
                            return true;
                        }

                        if (this.Properties.Is(IsoFlagType.noStart)) {
                            return true;
                        }

                        IsoGridSquare isoGridSquare1 = getter.getGridSquare(gridSquare.x, gridSquare.y, this.z);
                        if (isoGridSquare1 == null) {
                            return false;
                        }

                        if ((isoGridSquare1.SolidFloorCached ? isoGridSquare1.SolidFloor : isoGridSquare1.TreatAsSolidFloor())
                            && !isoGridSquare1.getProperties().Is(IsoFlagType.transparentFloor)) {
                            return true;
                        }
                    }
                }

                if (gridSquare.x > this.x && gridSquare.Properties.Is(IsoFlagType.transparentW)) {
                    return false;
                } else if (gridSquare.y > this.y && gridSquare.Properties.Is(IsoFlagType.transparentN)) {
                    return false;
                } else if (gridSquare.x < this.x && this.Properties.Is(IsoFlagType.transparentW)) {
                    return false;
                } else if (gridSquare.y < this.y && this.Properties.Is(IsoFlagType.transparentN)) {
                    return false;
                } else if (gridSquare.x > this.x && gridSquare.Properties.Is(IsoFlagType.doorW)) {
                    return false;
                } else if (gridSquare.y > this.y && gridSquare.Properties.Is(IsoFlagType.doorN)) {
                    return false;
                } else if (gridSquare.x < this.x && this.Properties.Is(IsoFlagType.doorW)) {
                    return false;
                } else if (gridSquare.y < this.y && this.Properties.Is(IsoFlagType.doorN)) {
                    return false;
                } else {
                    boolean boolean4 = boolean2 && this.Properties.Is(IsoFlagType.collideN);
                    boolean boolean5 = boolean0 && this.Properties.Is(IsoFlagType.collideW);
                    boolean boolean6 = boolean3 && gridSquare.Properties.Is(IsoFlagType.collideN);
                    boolean boolean7 = boolean1 && gridSquare.Properties.Is(IsoFlagType.collideW);
                    if (!boolean4 && !boolean5 && !boolean6 && !boolean7) {
                        boolean boolean8 = gridSquare.x != this.x && gridSquare.y != this.y;
                        if (!gridSquare.Properties.Is(IsoFlagType.solid) && !gridSquare.Properties.Is(IsoFlagType.blocksight)) {
                            if (boolean8) {
                                IsoGridSquare isoGridSquare2 = getter.getGridSquare(this.x, gridSquare.y, this.z);
                                IsoGridSquare isoGridSquare3 = getter.getGridSquare(gridSquare.x, this.y, this.z);
                                if (isoGridSquare2 != null && isoGridSquare2 != this && isoGridSquare2 != gridSquare) {
                                    isoGridSquare2.RecalcPropertiesIfNeeded();
                                }

                                if (isoGridSquare3 != null && isoGridSquare3 != this && isoGridSquare3 != gridSquare) {
                                    isoGridSquare3.RecalcPropertiesIfNeeded();
                                }

                                if (this.CalculateVisionBlocked(isoGridSquare2)) {
                                    return true;
                                }

                                if (this.CalculateVisionBlocked(isoGridSquare3)) {
                                    return true;
                                }

                                if (gridSquare.CalculateVisionBlocked(isoGridSquare2)) {
                                    return true;
                                }

                                if (gridSquare.CalculateVisionBlocked(isoGridSquare3)) {
                                    return true;
                                }
                            }

                            return false;
                        } else {
                            return true;
                        }
                    } else {
                        return true;
                    }
                }
            } else {
                return false;
            }
        } else {
            return true;
        }
    }

    public IsoGameCharacter FindFriend(IsoGameCharacter g, int range, Stack<IsoGameCharacter> EnemyList) {
        Stack stack = new Stack();

        for (int _int = 0; _int < g.getLocalList().size(); _int++) {
            IsoMovingObject isoMovingObject = (IsoMovingObject)g.getLocalList().get(_int);
            if (isoMovingObject != g
                && isoMovingObject != g.getFollowingTarget()
                && isoMovingObject instanceof IsoGameCharacter
                && !(isoMovingObject instanceof IsoZombie)
                && !EnemyList.contains(isoMovingObject)) {
                stack.add((IsoGameCharacter)isoMovingObject);
            }
        }

        float float0 = 1000000.0F;
        IsoGameCharacter isoGameCharacter0 = null;

        for (IsoGameCharacter isoGameCharacter1 : stack) {
            float float1 = 0.0F;
            float1 += Math.abs((float)this.getX() - isoGameCharacter1.getX());
            float1 += Math.abs((float)this.getY() - isoGameCharacter1.getY());
            float1 += Math.abs((float)this.getZ() - isoGameCharacter1.getZ());
            if (float1 < float0) {
                isoGameCharacter0 = isoGameCharacter1;
                float0 = float1;
            }

            if (isoGameCharacter1 == IsoPlayer.getInstance()) {
                isoGameCharacter0 = isoGameCharacter1;
                float1 = 0.0F;
            }
        }

        return float0 > (float)range ? null : isoGameCharacter0;
    }

    public IsoGameCharacter FindEnemy(IsoGameCharacter g, int range, ArrayList<IsoMovingObject> EnemyList, IsoGameCharacter RangeTest, int TestRangeMax) {
        float float0 = 1000000.0F;
        IsoGameCharacter isoGameCharacter0 = null;

        for (int _int = 0; _int < EnemyList.size(); _int++) {
            IsoGameCharacter isoGameCharacter1 = (IsoGameCharacter)EnemyList.get(_int);
            float float1 = 0.0F;
            float1 += Math.abs((float)this.getX() - isoGameCharacter1.getX());
            float1 += Math.abs((float)this.getY() - isoGameCharacter1.getY());
            float1 += Math.abs((float)this.getZ() - isoGameCharacter1.getZ());
            if (float1 < (float)range && float1 < float0 && isoGameCharacter1.DistTo(RangeTest) < (float)TestRangeMax) {
                isoGameCharacter0 = isoGameCharacter1;
                float0 = float1;
            }
        }

        return float0 > (float)range ? null : isoGameCharacter0;
    }

    public IsoGameCharacter FindEnemy(IsoGameCharacter g, int range, ArrayList<IsoMovingObject> EnemyList) {
        float float0 = 1000000.0F;
        IsoGameCharacter isoGameCharacter0 = null;

        for (int _int = 0; _int < EnemyList.size(); _int++) {
            IsoGameCharacter isoGameCharacter1 = (IsoGameCharacter)EnemyList.get(_int);
            float float1 = 0.0F;
            float1 += Math.abs((float)this.getX() - isoGameCharacter1.getX());
            float1 += Math.abs((float)this.getY() - isoGameCharacter1.getY());
            float1 += Math.abs((float)this.getZ() - isoGameCharacter1.getZ());
            if (float1 < float0) {
                isoGameCharacter0 = isoGameCharacter1;
                float0 = float1;
            }
        }

        return float0 > (float)range ? null : isoGameCharacter0;
    }

    public int getX() {
        return this.x;
    }

    public int getY() {
        return this.y;
    }

    public int getZ() {
        return this.z;
    }

    public void RecalcProperties() {
        this.CachedIsFree = false;
        String string0 = null;
        if (this.Properties.Is("waterAmount")) {
            string0 = this.Properties.Val("waterAmount");
        }

        String string1 = null;
        if (this.Properties.Is("fuelAmount")) {
            string1 = this.Properties.Val("fuelAmount");
        }

        if (this.zone == null) {
            this.zone = IsoWorld.instance.MetaGrid.getZoneAt(this.x, this.y, this.z);
        }

        this.Properties.Clear();
        this.hasTypes.clear();
        this.hasTree = false;
        boolean boolean0 = false;
        boolean boolean1 = false;
        boolean boolean2 = false;
        boolean boolean3 = false;
        boolean boolean4 = false;
        boolean boolean5 = false;
        boolean boolean6 = false;
        boolean boolean7 = false;
        int int0 = this.Objects.size();
        IsoObject[] isoObject0 = this.Objects.getElements();

        for (int int1 = 0; int1 < int0; int1++) {
            IsoObject isoObject1 = isoObject0[int1];
            if (isoObject1 != null) {
                PropertyContainer propertyContainer = isoObject1.getProperties();
                if (propertyContainer != null && !propertyContainer.Is(IsoFlagType.blueprint)) {
                    if (isoObject1.sprite.forceRender) {
                        boolean7 = true;
                    }

                    if (isoObject1.getType() == IsoObjectType.tree) {
                        this.hasTree = true;
                    }

                    this.hasTypes.set(isoObject1.getType(), true);
                    this.Properties.AddProperties(propertyContainer);
                    if (propertyContainer.Is(IsoFlagType.water)) {
                        boolean1 = false;
                    } else {
                        if (!boolean1 && propertyContainer.Is(IsoFlagType.solidfloor)) {
                            boolean1 = true;
                        }

                        if (!boolean0 && propertyContainer.Is(IsoFlagType.solidtrans)) {
                            boolean0 = true;
                        }

                        if (!boolean2 && propertyContainer.Is(IsoFlagType.solidfloor) && !propertyContainer.Is(IsoFlagType.transparentFloor)) {
                            boolean2 = true;
                        }
                    }

                    if (!boolean3 && propertyContainer.Is(IsoFlagType.collideN) && !propertyContainer.Is(IsoFlagType.HoppableN)) {
                        boolean3 = true;
                    }

                    if (!boolean4 && propertyContainer.Is(IsoFlagType.collideW) && !propertyContainer.Is(IsoFlagType.HoppableW)) {
                        boolean4 = true;
                    }

                    if (!boolean5 && propertyContainer.Is(IsoFlagType.cutN) && !propertyContainer.Is(IsoFlagType.transparentN)) {
                        boolean5 = true;
                    }

                    if (!boolean6 && propertyContainer.Is(IsoFlagType.cutW) && !propertyContainer.Is(IsoFlagType.transparentW)) {
                        boolean6 = true;
                    }
                }
            }
        }

        if (this.roomID == -1 && !this.haveRoof) {
            this.getProperties().Set(IsoFlagType.exterior);

            try {
                this.getPuddles().bRecalc = true;
            } catch (Exception exception0) {
                exception0.printStackTrace();
            }
        } else {
            this.getProperties().UnSet(IsoFlagType.exterior);

            try {
                this.getPuddles().bRecalc = true;
            } catch (Exception exception1) {
                exception1.printStackTrace();
            }
        }

        if (string0 != null) {
            this.getProperties().Set("waterAmount", string0, false);
        }

        if (string1 != null) {
            this.getProperties().Set("fuelAmount", string1, false);
        }

        if (this.RainDrop != null) {
            this.Properties.Set(IsoFlagType.HasRaindrop);
        }

        if (boolean7) {
            this.Properties.Set(IsoFlagType.forceRender);
        }

        if (this.RainSplash != null) {
            this.Properties.Set(IsoFlagType.HasRainSplashes);
        }

        if (this.burntOut) {
            this.Properties.Set(IsoFlagType.burntOut);
        }

        if (!boolean0 && boolean1 && this.Properties.Is(IsoFlagType.water)) {
            this.Properties.UnSet(IsoFlagType.solidtrans);
        }

        if (boolean2 && this.Properties.Is(IsoFlagType.transparentFloor)) {
            this.Properties.UnSet(IsoFlagType.transparentFloor);
        }

        if (boolean3 && this.Properties.Is(IsoFlagType.HoppableN)) {
            this.Properties.UnSet(IsoFlagType.canPathN);
            this.Properties.UnSet(IsoFlagType.HoppableN);
        }

        if (boolean4 && this.Properties.Is(IsoFlagType.HoppableW)) {
            this.Properties.UnSet(IsoFlagType.canPathW);
            this.Properties.UnSet(IsoFlagType.HoppableW);
        }

        if (boolean5 && this.Properties.Is(IsoFlagType.transparentN)) {
            this.Properties.UnSet(IsoFlagType.transparentN);
        }

        if (boolean6 && this.Properties.Is(IsoFlagType.transparentW)) {
            this.Properties.UnSet(IsoFlagType.transparentW);
        }

        this.propertiesDirty = this.chunk == null || this.chunk.bLoaded;
        if (this.chunk != null) {
            this.chunk.lightCheck[0] = this.chunk.lightCheck[1] = this.chunk.lightCheck[2] = this.chunk.lightCheck[3] = true;
        }

        if (this.chunk != null) {
            this.chunk.physicsCheck = true;
            this.chunk.collision.clear();
        }

        this.isExteriorCache = this.Is(IsoFlagType.exterior);
        this.isSolidFloorCache = this.Is(IsoFlagType.solidfloor);
        this.isVegitationCache = this.Is(IsoFlagType.vegitation);
    }

    public void RecalcPropertiesIfNeeded() {
        if (this.propertiesDirty) {
            this.RecalcProperties();
        }
    }

    public void ReCalculateCollide(IsoGridSquare square) {
        this.ReCalculateCollide(square, cellGetSquare);
    }

    public void ReCalculateCollide(IsoGridSquare square, IsoGridSquare.GetSquare getter) {
        if (1 + (square.x - this.x) < 0 || 1 + (square.y - this.y) < 0 || 1 + (square.z - this.z) < 0) {
            DebugLog.log("ERROR");
        }

        boolean _boolean = this.CalculateCollide(square, false, false, false, false, getter);
        this.collideMatrix = setMatrixBit(this.collideMatrix, 1 + (square.x - this.x), 1 + (square.y - this.y), 1 + (square.z - this.z), _boolean);
    }

    public void ReCalculatePathFind(IsoGridSquare square) {
        this.ReCalculatePathFind(square, cellGetSquare);
    }

    public void ReCalculatePathFind(IsoGridSquare square, IsoGridSquare.GetSquare getter) {
        boolean _boolean = this.CalculateCollide(square, false, true, false, false, getter);
        this.pathMatrix = setMatrixBit(this.pathMatrix, 1 + (square.x - this.x), 1 + (square.y - this.y), 1 + (square.z - this.z), _boolean);
    }

    public void ReCalculateVisionBlocked(IsoGridSquare square) {
        this.ReCalculateVisionBlocked(square, cellGetSquare);
    }

    public void ReCalculateVisionBlocked(IsoGridSquare square, IsoGridSquare.GetSquare getter) {
        boolean _boolean = this.CalculateVisionBlocked(square, getter);
        this.visionMatrix = setMatrixBit(this.visionMatrix, 1 + (square.x - this.x), 1 + (square.y - this.y), 1 + (square.z - this.z), _boolean);
    }

    private static boolean testCollideSpecialObjects(IsoMovingObject isoMovingObject, IsoGridSquare isoGridSquare1, IsoGridSquare isoGridSquare0) {
        for (int _int = 0; _int < isoGridSquare0.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)isoGridSquare0.SpecialObjects.get(_int);
            if (isoObject.TestCollide(isoMovingObject, isoGridSquare1, isoGridSquare0)) {
                if (isoObject instanceof IsoDoor) {
                    isoMovingObject.setCollidedWithDoor(true);
                } else if (isoObject instanceof IsoThumpable && ((IsoThumpable)isoObject).isDoor) {
                    isoMovingObject.setCollidedWithDoor(true);
                }

                isoMovingObject.setCollidedObject(isoObject);
                return true;
            }
        }

        return false;
    }

    public boolean testCollideAdjacent(IsoMovingObject collideObject, int _x, int _y, int _z) {
        if (collideObject instanceof IsoPlayer && ((IsoPlayer)collideObject).isNoClip()) {
            return false;
        } else if (this.collideMatrix == -1) {
            return true;
        } else if (_x >= -1 && _x <= 1 && _y >= -1 && _y <= 1 && _z >= -1 && _z <= 1) {
            if (this.x + _x >= 0 && this.y + _y >= 0 && IsoWorld.instance.MetaGrid.isValidChunk((this.x + _x) / 10, (this.y + _y) / 10)) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x + _x, this.y + _y, this.z + _z);
                SafeHouse safeHouse = null;
                if ((GameServer.bServer || GameClient.bClient)
                    && collideObject instanceof IsoPlayer
                    && !ServerOptions.instance.SafehouseAllowTrepass.getValue()) {
                    IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(this.x + _x, this.y + _y, 0);
                    safeHouse = SafeHouse.isSafeHouse(isoGridSquare1, ((IsoPlayer)collideObject).getUsername(), true);
                }

                if (safeHouse != null) {
                    return true;
                } else {
                    if (isoGridSquare0 != null && collideObject != null) {
                        IsoObject isoObject = this.testCollideSpecialObjects(isoGridSquare0);
                        if (isoObject != null) {
                            collideObject.collideWith(isoObject);
                            if (isoObject instanceof IsoDoor) {
                                collideObject.setCollidedWithDoor(true);
                            } else if (isoObject instanceof IsoThumpable && ((IsoThumpable)isoObject).isDoor) {
                                collideObject.setCollidedWithDoor(true);
                            }

                            collideObject.setCollidedObject(isoObject);
                            return true;
                        }
                    }

                    if (UseSlowCollision) {
                        return this.CalculateCollide(isoGridSquare0, false, false, false);
                    } else {
                        if (collideObject instanceof IsoPlayer && getMatrixBit(this.collideMatrix, _x + 1, _y + 1, _z + 1)) {
                            this.RecalcAllWithNeighbours(true);
                        }

                        return getMatrixBit(this.collideMatrix, _x + 1, _y + 1, _z + 1);
                    }
                }
            } else {
                return true;
            }
        } else {
            return true;
        }
    }

    public boolean testCollideAdjacentAdvanced(int _x, int _y, int _z, boolean ignoreDoors) {
        if (this.collideMatrix == -1) {
            return true;
        } else if (_x >= -1 && _x <= 1 && _y >= -1 && _y <= 1 && _z >= -1 && _z <= 1) {
            IsoGridSquare isoGridSquare = this.getCell().getGridSquare(this.x + _x, this.y + _y, this.z + _z);
            if (isoGridSquare != null) {
                if (!isoGridSquare.SpecialObjects.isEmpty()) {
                    for (int int0 = 0; int0 < isoGridSquare.SpecialObjects.size(); int0++) {
                        IsoObject isoObject0 = (IsoObject)isoGridSquare.SpecialObjects.get(int0);
                        if (isoObject0.TestCollide(null, this, isoGridSquare)) {
                            return true;
                        }
                    }
                }

                if (!this.SpecialObjects.isEmpty()) {
                    for (int int1 = 0; int1 < this.SpecialObjects.size(); int1++) {
                        IsoObject isoObject1 = (IsoObject)this.SpecialObjects.get(int1);
                        if (isoObject1.TestCollide(null, this, isoGridSquare)) {
                            return true;
                        }
                    }
                }
            }

            return UseSlowCollision ? this.CalculateCollide(isoGridSquare, false, false, false) : getMatrixBit(this.collideMatrix, _x + 1, _y + 1, _z + 1);
        } else {
            return true;
        }
    }

    public static void setCollisionMode() {
        UseSlowCollision = !UseSlowCollision;
    }

    public boolean testPathFindAdjacent(IsoMovingObject mover, int _x, int _y, int _z) {
        return this.testPathFindAdjacent(mover, _x, _y, _z, cellGetSquare);
    }

    public boolean testPathFindAdjacent(IsoMovingObject mover, int _x, int _y, int _z, IsoGridSquare.GetSquare getter) {
        if (_x >= -1 && _x <= 1 && _y >= -1 && _y <= 1 && _z >= -1 && _z <= 1) {
            if (this.Has(IsoObjectType.stairsTN) || this.Has(IsoObjectType.stairsTW)) {
                IsoGridSquare isoGridSquare0 = getter.getGridSquare(_x + this.x, _y + this.y, _z + this.z);
                if (isoGridSquare0 == null) {
                    return true;
                }

                if (this.Has(IsoObjectType.stairsTN) && isoGridSquare0.y < this.y && isoGridSquare0.z == this.z) {
                    return true;
                }

                if (this.Has(IsoObjectType.stairsTW) && isoGridSquare0.x < this.x && isoGridSquare0.z == this.z) {
                    return true;
                }
            }

            if (bDoSlowPathfinding) {
                IsoGridSquare isoGridSquare1 = getter.getGridSquare(_x + this.x, _y + this.y, _z + this.z);
                return this.CalculateCollide(isoGridSquare1, false, true, false, false, getter);
            } else {
                return getMatrixBit(this.pathMatrix, _x + 1, _y + 1, _z + 1);
            }
        } else {
            return true;
        }
    }

    public LosUtil.TestResults testVisionAdjacent(int _x, int _y, int _z, boolean specialDiag, boolean bIgnoreDoors) {
        if (_x >= -1 && _x <= 1 && _y >= -1 && _y <= 1 && _z >= -1 && _z <= 1) {
            if (_z == 1 && (_x != 0 || _y != 0) && this.HasElevatedFloor()) {
                IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.x, this.y, this.z + _z);
                if (isoGridSquare0 != null) {
                    return isoGridSquare0.testVisionAdjacent(_x, _y, 0, specialDiag, bIgnoreDoors);
                }
            }

            if (_z == -1 && (_x != 0 || _y != 0)) {
                IsoGridSquare isoGridSquare1 = this.getCell().getGridSquare(this.x + _x, this.y + _y, this.z + _z);
                if (isoGridSquare1 != null && isoGridSquare1.HasElevatedFloor()) {
                    return this.testVisionAdjacent(_x, _y, 0, specialDiag, bIgnoreDoors);
                }
            }

            LosUtil.TestResults testResults0 = LosUtil.TestResults.Clear;
            if (_x != 0 && _y != 0 && specialDiag) {
                testResults0 = this.DoDiagnalCheck(_x, _y, _z, bIgnoreDoors);
                if (testResults0 == LosUtil.TestResults.Clear
                    || testResults0 == LosUtil.TestResults.ClearThroughWindow
                    || testResults0 == LosUtil.TestResults.ClearThroughOpenDoor
                    || testResults0 == LosUtil.TestResults.ClearThroughClosedDoor) {
                    IsoGridSquare isoGridSquare2 = this.getCell().getGridSquare(this.x + _x, this.y + _y, this.z + _z);
                    if (isoGridSquare2 != null) {
                        testResults0 = isoGridSquare2.DoDiagnalCheck(-_x, -_y, -_z, bIgnoreDoors);
                    }
                }

                return testResults0;
            } else {
                IsoGridSquare isoGridSquare3 = this.getCell().getGridSquare(this.x + _x, this.y + _y, this.z + _z);
                LosUtil.TestResults testResults1 = LosUtil.TestResults.Clear;
                if (isoGridSquare3 != null && isoGridSquare3.z == this.z) {
                    if (!this.SpecialObjects.isEmpty()) {
                        for (int int0 = 0; int0 < this.SpecialObjects.size(); int0++) {
                            IsoObject isoObject0 = (IsoObject)this.SpecialObjects.get(int0);
                            if (isoObject0 == null) {
                                return LosUtil.TestResults.Clear;
                            }

                            IsoObject.VisionResult visionResult0 = isoObject0.TestVision(this, isoGridSquare3);
                            if (visionResult0 != IsoObject.VisionResult.NoEffect) {
                                if (visionResult0 == IsoObject.VisionResult.Unblocked && isoObject0 instanceof IsoDoor) {
                                    testResults1 = ((IsoDoor)isoObject0).IsOpen()
                                        ? LosUtil.TestResults.ClearThroughOpenDoor
                                        : LosUtil.TestResults.ClearThroughClosedDoor;
                                } else if (visionResult0 == IsoObject.VisionResult.Unblocked
                                    && isoObject0 instanceof IsoThumpable
                                    && ((IsoThumpable)isoObject0).isDoor) {
                                    testResults1 = LosUtil.TestResults.ClearThroughOpenDoor;
                                } else if (visionResult0 == IsoObject.VisionResult.Unblocked && isoObject0 instanceof IsoWindow) {
                                    testResults1 = LosUtil.TestResults.ClearThroughWindow;
                                } else {
                                    if (visionResult0 == IsoObject.VisionResult.Blocked && isoObject0 instanceof IsoDoor && !bIgnoreDoors) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult0 == IsoObject.VisionResult.Blocked
                                        && isoObject0 instanceof IsoThumpable
                                        && ((IsoThumpable)isoObject0).isDoor
                                        && !bIgnoreDoors) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult0 == IsoObject.VisionResult.Blocked
                                        && isoObject0 instanceof IsoThumpable
                                        && ((IsoThumpable)isoObject0).isWindow()) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult0 == IsoObject.VisionResult.Blocked && isoObject0 instanceof IsoCurtain) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult0 == IsoObject.VisionResult.Blocked && isoObject0 instanceof IsoWindow) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult0 == IsoObject.VisionResult.Blocked && isoObject0 instanceof IsoBarricade) {
                                        return LosUtil.TestResults.Blocked;
                                    }
                                }
                            }
                        }
                    }

                    if (!isoGridSquare3.SpecialObjects.isEmpty()) {
                        for (int int1 = 0; int1 < isoGridSquare3.SpecialObjects.size(); int1++) {
                            IsoObject isoObject1 = (IsoObject)isoGridSquare3.SpecialObjects.get(int1);
                            if (isoObject1 == null) {
                                return LosUtil.TestResults.Clear;
                            }

                            IsoObject.VisionResult visionResult1 = isoObject1.TestVision(this, isoGridSquare3);
                            if (visionResult1 != IsoObject.VisionResult.NoEffect) {
                                if (visionResult1 == IsoObject.VisionResult.Unblocked && isoObject1 instanceof IsoDoor) {
                                    testResults1 = ((IsoDoor)isoObject1).IsOpen()
                                        ? LosUtil.TestResults.ClearThroughOpenDoor
                                        : LosUtil.TestResults.ClearThroughClosedDoor;
                                } else if (visionResult1 == IsoObject.VisionResult.Unblocked
                                    && isoObject1 instanceof IsoThumpable
                                    && ((IsoThumpable)isoObject1).isDoor) {
                                    testResults1 = LosUtil.TestResults.ClearThroughOpenDoor;
                                } else if (visionResult1 == IsoObject.VisionResult.Unblocked && isoObject1 instanceof IsoWindow) {
                                    testResults1 = LosUtil.TestResults.ClearThroughWindow;
                                } else {
                                    if (visionResult1 == IsoObject.VisionResult.Blocked && isoObject1 instanceof IsoDoor && !bIgnoreDoors) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult1 == IsoObject.VisionResult.Blocked
                                        && isoObject1 instanceof IsoThumpable
                                        && ((IsoThumpable)isoObject1).isDoor
                                        && !bIgnoreDoors) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult1 == IsoObject.VisionResult.Blocked
                                        && isoObject1 instanceof IsoThumpable
                                        && ((IsoThumpable)isoObject1).isWindow()) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult1 == IsoObject.VisionResult.Blocked && isoObject1 instanceof IsoCurtain) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult1 == IsoObject.VisionResult.Blocked && isoObject1 instanceof IsoWindow) {
                                        return LosUtil.TestResults.Blocked;
                                    }

                                    if (visionResult1 == IsoObject.VisionResult.Blocked && isoObject1 instanceof IsoBarricade) {
                                        return LosUtil.TestResults.Blocked;
                                    }
                                }
                            }
                        }
                    }
                }

                return !getMatrixBit(this.visionMatrix, _x + 1, _y + 1, _z + 1) ? testResults1 : LosUtil.TestResults.Blocked;
            }
        } else {
            return LosUtil.TestResults.Blocked;
        }
    }

    public boolean TreatAsSolidFloor() {
        if (this.SolidFloorCached) {
            return this.SolidFloor;
        } else {
            if (!this.Properties.Is(IsoFlagType.solidfloor) && !this.HasStairs()) {
                this.SolidFloor = false;
            } else {
                this.SolidFloor = true;
            }

            this.SolidFloorCached = true;
            return this.SolidFloor;
        }
    }

    public void AddSpecialTileObject(IsoObject obj) {
        this.AddSpecialObject(obj);
    }

    public void renderCharacters(int maxZ, boolean deadRender, boolean doBlendFunc) {
        if (this.z < maxZ) {
            if (!isOnScreenLast) {
            }

            if (doBlendFunc) {
                zombie.IndieGL.glBlendFunc(770, 771);
            }

            if (this.MovingObjects.size() > 1) {
                Collections.sort(this.MovingObjects, comp);
            }

            int int0 = IsoCamera.frameState.playerIndex;
            ColorInfo colorInfo = this.lightInfo[int0];
            int int1 = this.StaticMovingObjects.size();

            for (int int2 = 0; int2 < int1; int2++) {
                IsoMovingObject isoMovingObject0 = (IsoMovingObject)this.StaticMovingObjects.get(int2);
                if ((isoMovingObject0.sprite != null || isoMovingObject0 instanceof IsoDeadBody)
                    && (!deadRender || isoMovingObject0 instanceof IsoDeadBody && !this.HasStairs())
                    && (deadRender || !(isoMovingObject0 instanceof IsoDeadBody) || this.HasStairs())) {
                    isoMovingObject0.render(isoMovingObject0.getX(), isoMovingObject0.getY(), isoMovingObject0.getZ(), colorInfo, true, false, null);
                }
            }

            int1 = this.MovingObjects.size();

            for (int int3 = 0; int3 < int1; int3++) {
                IsoMovingObject isoMovingObject1 = (IsoMovingObject)this.MovingObjects.get(int3);
                if (isoMovingObject1 != null && isoMovingObject1.sprite != null) {
                    boolean _boolean = isoMovingObject1.bOnFloor;
                    if (_boolean && isoMovingObject1 instanceof IsoZombie) {
                        IsoZombie isoZombie = (IsoZombie)isoMovingObject1;
                        _boolean = isoZombie.isProne();
                        if (!BaseVehicle.RENDER_TO_TEXTURE) {
                            _boolean = false;
                        }
                    }

                    if ((!deadRender || _boolean) && (deadRender || !_boolean)) {
                        isoMovingObject1.render(isoMovingObject1.getX(), isoMovingObject1.getY(), isoMovingObject1.getZ(), colorInfo, true, false, null);
                    }
                }
            }
        }
    }

    public void renderDeferredCharacters(int maxZ) {
        if (!this.DeferedCharacters.isEmpty()) {
            if (this.DeferredCharacterTick != this.getCell().DeferredCharacterTick) {
                this.DeferedCharacters.clear();
            } else if (this.z >= maxZ) {
                this.DeferedCharacters.clear();
            } else if (PerformanceSettings.LightingFrameSkip != 3) {
                short _short = this.getCell().getStencilValue2z(this.x, this.y, this.z - 1);
                this.getCell().setStencilValue2z(this.x, this.y, this.z - 1, _short);
                zombie.IndieGL.enableAlphaTest();
                zombie.IndieGL.glAlphaFunc(516, 0.0F);
                zombie.IndieGL.glStencilFunc(519, _short, 127);
                zombie.IndieGL.glStencilOp(7680, 7680, 7681);
                float float0 = IsoUtils.XToScreen((float)this.x, (float)this.y, (float)this.z, 0);
                float float1 = IsoUtils.YToScreen((float)this.x, (float)this.y, (float)this.z, 0);
                float0 -= IsoCamera.frameState.OffX;
                float1 -= IsoCamera.frameState.OffY;
                zombie.IndieGL.glColorMask(false, false, false, false);
                Texture.getWhite().renderwallnw(float0, float1, (float)(64 * Core.TileScale), (float)(32 * Core.TileScale), -1, -1, -1, -1, -1, -1);
                zombie.IndieGL.glColorMask(true, true, true, true);
                zombie.IndieGL.enableAlphaTest();
                zombie.IndieGL.glAlphaFunc(516, 0.0F);
                zombie.IndieGL.glStencilFunc(514, _short, 127);
                zombie.IndieGL.glStencilOp(7680, 7680, 7680);
                ColorInfo colorInfo = this.lightInfo[IsoCamera.frameState.playerIndex];
                Collections.sort(this.DeferedCharacters, comp);

                for (int _int = 0; _int < this.DeferedCharacters.size(); _int++) {
                    IsoGameCharacter isoGameCharacter = (IsoGameCharacter)this.DeferedCharacters.get(_int);
                    if (isoGameCharacter.sprite != null) {
                        isoGameCharacter.setbDoDefer(false);
                        isoGameCharacter.render(isoGameCharacter.getX(), isoGameCharacter.getY(), isoGameCharacter.getZ(), colorInfo, true, false, null);
                        isoGameCharacter.renderObjectPicker(isoGameCharacter.getX(), isoGameCharacter.getY(), isoGameCharacter.getZ(), colorInfo);
                        isoGameCharacter.setbDoDefer(true);
                    }
                }

                this.DeferedCharacters.clear();
                zombie.IndieGL.glAlphaFunc(516, 0.0F);
                zombie.IndieGL.glStencilFunc(519, 1, 255);
                zombie.IndieGL.glStencilOp(7680, 7680, 7680);
            }
        }
    }

    public void switchLight(boolean active) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject instanceof IsoLightSwitch) {
                ((IsoLightSwitch)isoObject).setActive(active);
            }
        }
    }

    public void removeLightSwitch() {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject = this.Objects.get(_int);
            if (isoObject instanceof IsoLightSwitch) {
                this.Objects.remove(_int);
                _int--;
            }
        }
    }

    public boolean IsOnScreen() {
        return this.IsOnScreen(false);
    }

    public boolean IsOnScreen(boolean halfTileBorder) {
        if (this.CachedScreenValue != Core.TileScale) {
            this.CachedScreenX = IsoUtils.XToScreen((float)this.x, (float)this.y, (float)this.z, 0);
            this.CachedScreenY = IsoUtils.YToScreen((float)this.x, (float)this.y, (float)this.z, 0);
            this.CachedScreenValue = Core.TileScale;
        }

        float float0 = this.CachedScreenX;
        float float1 = this.CachedScreenY;
        float0 -= IsoCamera.frameState.OffX;
        float1 -= IsoCamera.frameState.OffY;
        int int0 = halfTileBorder ? 32 * Core.TileScale : 0;
        if (this.hasTree) {
            int int1 = 384 * Core.TileScale / 2 - 96 * Core.TileScale;
            int int2 = 256 * Core.TileScale - 32 * Core.TileScale;
            if (float0 + (float)int1 <= (float)(0 - int0)) {
                return false;
            } else if (float1 + (float)(32 * Core.TileScale) <= (float)(0 - int0)) {
                return false;
            } else {
                return float0 - (float)int1 >= (float)(IsoCamera.frameState.OffscreenWidth + int0)
                    ? false
                    : !(float1 - (float)int2 >= (float)(IsoCamera.frameState.OffscreenHeight + int0));
            }
        } else if (float0 + (float)(32 * Core.TileScale) <= (float)(0 - int0)) {
            return false;
        } else if (float1 + (float)(32 * Core.TileScale) <= (float)(0 - int0)) {
            return false;
        } else {
            return float0 - (float)(32 * Core.TileScale) >= (float)(IsoCamera.frameState.OffscreenWidth + int0)
                ? false
                : !(float1 - (float)(96 * Core.TileScale) >= (float)(IsoCamera.frameState.OffscreenHeight + int0));
        }
    }

    void cacheLightInfo() {
        int _int = IsoCamera.frameState.playerIndex;
        this.lightInfo[_int] = this.lighting[_int].lightInfo();
    }

    public void setLightInfoServerGUIOnly(ColorInfo c) {
        this.lightInfo[0] = c;
    }

    int renderFloor(Shader shader) {
        int _int;
        try {
            IsoGridSquare.s_performance.renderFloor.start();
            _int = this.renderFloorInternal(shader);
        } finally {
            IsoGridSquare.s_performance.renderFloor.end();
        }

        return _int;
    }

    private int renderFloorInternal(Shader shader) {
        int int0 = IsoCamera.frameState.playerIndex;
        ColorInfo colorInfo = this.lightInfo[int0];
        IsoGridSquare isoGridSquare1 = IsoCamera.frameState.CamCharacterSquare;
        boolean boolean0 = this.lighting[int0].bCouldSee();
        float float0 = this.lighting[int0].darkMulti();
        boolean boolean1 = GameClient.bClient && IsoPlayer.players[int0] != null && IsoPlayer.players[int0].isSeeNonPvpZone();
        boolean boolean2 = Core.bDebug && GameClient.bClient && SafeHouse.isSafeHouse(this, null, true) != null;
        boolean boolean3 = true;
        float float1 = 1.0F;
        float float2 = 1.0F;
        if (isoGridSquare1 != null) {
            int int1 = this.getRoomID();
            if (int1 != -1) {
                int int2 = IsoWorld.instance.CurrentCell.GetEffectivePlayerRoomId();
                if (int2 == -1 && IsoWorld.instance.CurrentCell.CanBuildingSquareOccludePlayer(this, int0)) {
                    boolean3 = false;
                    float1 = 1.0F;
                    float2 = 1.0F;
                } else if (!boolean0 && int1 != int2 && float0 < 0.5F) {
                    boolean3 = false;
                    float1 = 0.0F;
                    float2 = float0 * 2.0F;
                }
            }
        }

        IsoWaterGeometry isoWaterGeometry = this.z == 0 ? this.getWater() : null;
        boolean boolean4 = isoWaterGeometry != null && isoWaterGeometry.bShore;
        float float3 = isoWaterGeometry == null ? 0.0F : isoWaterGeometry.depth[0];
        float float4 = isoWaterGeometry == null ? 0.0F : isoWaterGeometry.depth[3];
        float float5 = isoWaterGeometry == null ? 0.0F : isoWaterGeometry.depth[2];
        float float6 = isoWaterGeometry == null ? 0.0F : isoWaterGeometry.depth[1];
        byte _byte = 0;
        int int3 = this.Objects.size();
        IsoObject[] isoObject0 = this.Objects.getElements();

        for (int int4 = 0; int4 < int3; int4++) {
            IsoObject isoObject1 = isoObject0[int4];
            if (boolean1 && (isoObject1.highlightFlags & 1) == 0) {
                isoObject1.setHighlighted(true);
                if (NonPvpZone.getNonPvpZone(this.x, this.y) != null) {
                    isoObject1.setHighlightColor(0.6F, 0.6F, 1.0F, 0.5F);
                } else {
                    isoObject1.setHighlightColor(1.0F, 0.6F, 0.6F, 0.5F);
                }
            }

            if (boolean2) {
                isoObject1.setHighlighted(true);
                isoObject1.setHighlightColor(1.0F, 0.0F, 0.0F, 1.0F);
            }

            boolean boolean5 = true;
            if (isoObject1.sprite != null && !isoObject1.sprite.solidfloor && isoObject1.sprite.renderLayer != 1) {
                boolean5 = false;
                _byte |= 4;
            }

            if (isoObject1 instanceof IsoFire || isoObject1 instanceof IsoCarBatteryCharger) {
                boolean5 = false;
                _byte |= 4;
            }

            if (!boolean5) {
                boolean boolean6 = isoObject1.sprite != null && (isoObject1.sprite.isBush || isoObject1.sprite.canBeRemoved || isoObject1.sprite.attachedFloor);
                if (this.bFlattenGrassEtc && boolean6) {
                    _byte |= 2;
                }
            } else {
                zombie.IndieGL.glAlphaFunc(516, 0.0F);
                isoObject1.setTargetAlpha(int0, float2);
                if (boolean3) {
                    isoObject1.setAlpha(int0, float1);
                }

                if (DebugOptions.instance.Terrain.RenderTiles.RenderGridSquares.getValue() && isoObject1.sprite != null) {
                    zombie.IndieGL.StartShader(shader, int0);
                    FloorShaperAttachedSprites floorShaperAttachedSprites = FloorShaperAttachedSprites.instance;
                    Object object;
                    if (!isoObject1.getProperties().Is(IsoFlagType.diamondFloor) && !isoObject1.getProperties().Is(IsoFlagType.water)) {
                        object = FloorShaperDeDiamond.instance;
                    } else {
                        object = FloorShaperDiamond.instance;
                    }

                    int int5 = this.getVertLight(0, int0);
                    int int6 = this.getVertLight(1, int0);
                    int int7 = this.getVertLight(2, int0);
                    int int8 = this.getVertLight(3, int0);
                    if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Floor.LightingDebug.getValue()) {
                        int5 = -65536;
                        int6 = -65536;
                        int7 = -16776961;
                        int8 = -16776961;
                    }

                    floorShaperAttachedSprites.setShore(boolean4);
                    floorShaperAttachedSprites.setWaterDepth(float3, float4, float5, float6);
                    floorShaperAttachedSprites.setVertColors(int5, int6, int7, int8);
                    ((FloorShaper)object).setShore(boolean4);
                    ((FloorShaper)object).setWaterDepth(float3, float4, float5, float6);
                    ((FloorShaper)object).setVertColors(int5, int6, int7, int8);
                    isoObject1.renderFloorTile(
                        (float)this.x,
                        (float)this.y,
                        (float)this.z,
                        PerformanceSettings.LightingFrameSkip < 3 ? defColorInfo : colorInfo,
                        true,
                        false,
                        shader,
                        (Consumer<TextureDraw>)object,
                        floorShaperAttachedSprites
                    );
                    zombie.IndieGL.StartShader(null);
                }

                _byte |= 1;
                if ((isoObject1.highlightFlags & 1) == 0) {
                    _byte |= 8;
                }

                if ((isoObject1.highlightFlags & 2) != 0) {
                    isoObject1.highlightFlags &= -4;
                }
            }
        }

        if ((this.getCell().rainIntensity > 0 || RainManager.isRaining() && RainManager.RainIntensity > 0.0F)
            && this.isExteriorCache
            && !this.isVegitationCache
            && this.isSolidFloorCache
            && this.isCouldSee(int0)) {
            if (!IsoCamera.frameState.Paused) {
                int int9 = this.getCell().rainIntensity == 0
                    ? (int)Math.min(Math.floor((double)(RainManager.RainIntensity / 0.2F)) + 1.0, 5.0)
                    : this.getCell().rainIntensity;
                if (this.splashFrame < 0.0F && Rand.Next(Rand.AdjustForFramerate((int)(5.0F / (float)int9) * 100)) == 0) {
                    this.splashFrame = 0.0F;
                }
            }

            if (this.splashFrame >= 0.0F) {
                int int10 = (int)(this.splashFrame * 4.0F);
                if (rainsplashCache[int10] == null) {
                    rainsplashCache[int10] = "RainSplash_00_" + int10;
                }

                Texture texture = Texture.getSharedTexture(rainsplashCache[int10]);
                if (texture != null) {
                    float float7 = IsoUtils.XToScreen((float)this.x + this.splashX, (float)this.y + this.splashY, (float)this.z, 0) - IsoCamera.frameState.OffX;
                    float float8 = IsoUtils.YToScreen((float)this.x + this.splashX, (float)this.y + this.splashY, (float)this.z, 0) - IsoCamera.frameState.OffY;
                    float7 -= (float)(texture.getWidth() / 2 * Core.TileScale);
                    float8 -= (float)(texture.getHeight() / 2 * Core.TileScale);
                    float float9 = 0.6F * (this.getCell().rainIntensity > 0 ? 1.0F : RainManager.RainIntensity);
                    float float10 = Core.getInstance().RenderShader != null ? 0.6F : 1.0F;
                    SpriteRenderer.instance
                        .render(
                            texture,
                            float7,
                            float8,
                            (float)(texture.getWidth() * Core.TileScale),
                            (float)(texture.getHeight() * Core.TileScale),
                            0.8F * colorInfo.r,
                            0.9F * colorInfo.g,
                            1.0F * colorInfo.b,
                            float9 * float10,
                            null
                        );
                }

                if (!IsoCamera.frameState.Paused && this.splashFrameNum != IsoCamera.frameState.frameCount) {
                    this.splashFrame = this.splashFrame + 0.08F * (30.0F / (float)PerformanceSettings.getLockFPS());
                    if (this.splashFrame >= 1.0F) {
                        this.splashX = Rand.Next(0.1F, 0.9F);
                        this.splashY = Rand.Next(0.1F, 0.9F);
                        this.splashFrame = -1.0F;
                    }

                    this.splashFrameNum = IsoCamera.frameState.frameCount;
                }
            }
        } else {
            this.splashFrame = -1.0F;
        }

        return _byte;
    }

    private boolean isSpriteOnSouthOrEastWall(IsoObject isoObject) {
        if (isoObject instanceof IsoBarricade) {
            return isoObject.getDir() == IsoDirections.S || isoObject.getDir() == IsoDirections.E;
        } else if (isoObject instanceof IsoCurtain isoCurtain) {
            return isoCurtain.getType() == IsoObjectType.curtainS || isoCurtain.getType() == IsoObjectType.curtainE;
        } else {
            PropertyContainer propertyContainer = isoObject.getProperties();
            return propertyContainer != null && (propertyContainer.Is(IsoFlagType.attachedE) || propertyContainer.Is(IsoFlagType.attachedS));
        }
    }

    public void RenderOpenDoorOnly() {
        int int0 = this.Objects.size();
        IsoObject[] isoObject0 = this.Objects.getElements();

        try {
            byte _byte = 0;
            int int1 = int0 - 1;

            for (int int2 = _byte; int2 <= int1; int2++) {
                IsoObject isoObject1 = isoObject0[int2];
                if (isoObject1.sprite != null
                    && (isoObject1.sprite.getProperties().Is(IsoFlagType.attachedN) || isoObject1.sprite.getProperties().Is(IsoFlagType.attachedW))) {
                    isoObject1.renderFxMask((float)this.x, (float)this.y, (float)this.z, false);
                }
            }
        } catch (Exception exception) {
            ExceptionLogger.logException(exception);
        }
    }

    public boolean RenderMinusFloorFxMask(int maxZ, boolean doSE, boolean vegitationRender) {
        boolean boolean0 = false;
        int int0 = this.Objects.size();
        IsoObject[] isoObject0 = this.Objects.getElements();
        long _long = System.currentTimeMillis();

        try {
            int int1 = doSE ? int0 - 1 : 0;
            int int2 = doSE ? 0 : int0 - 1;

            for (int int3 = int1; doSE ? int3 >= int2 : int3 <= int2; int3 += doSE ? -1 : 1) {
                IsoObject isoObject1 = isoObject0[int3];
                if (isoObject1.sprite != null) {
                    boolean boolean1 = true;
                    IsoObjectType isoObjectType = isoObject1.sprite.getType();
                    if (isoObject1.sprite.solidfloor || isoObject1.sprite.renderLayer == 1) {
                        boolean1 = false;
                    }

                    if (this.z >= maxZ && !isoObject1.sprite.alwaysDraw) {
                        boolean1 = false;
                    }

                    boolean boolean2 = isoObject1.sprite.isBush || isoObject1.sprite.canBeRemoved || isoObject1.sprite.attachedFloor;
                    if ((!vegitationRender || boolean2 && this.bFlattenGrassEtc) && (vegitationRender || !boolean2 || !this.bFlattenGrassEtc)) {
                        if ((isoObjectType == IsoObjectType.WestRoofB || isoObjectType == IsoObjectType.WestRoofM || isoObjectType == IsoObjectType.WestRoofT)
                            && this.z == maxZ - 1
                            && this.z == (int)IsoCamera.CamCharacter.getZ()) {
                            boolean1 = false;
                        }

                        if (this.isSpriteOnSouthOrEastWall(isoObject1)) {
                            if (!doSE) {
                                boolean1 = false;
                            }

                            boolean0 = true;
                        } else if (doSE) {
                            boolean1 = false;
                        }

                        if (boolean1) {
                            if (!isoObject1.sprite.cutW && !isoObject1.sprite.cutN) {
                                isoObject1.renderFxMask((float)this.x, (float)this.y, (float)this.z, false);
                            } else {
                                int int4 = IsoCamera.frameState.playerIndex;
                                boolean boolean3 = isoObject1.sprite.cutN;
                                boolean boolean4 = isoObject1.sprite.cutW;
                                IsoGridSquare isoGridSquare0 = this.nav[IsoDirections.S.index()];
                                IsoGridSquare isoGridSquare1 = this.nav[IsoDirections.E.index()];
                                boolean boolean5 = isoGridSquare0 != null && isoGridSquare0.getPlayerCutawayFlag(int4, _long);
                                boolean boolean6 = this.getPlayerCutawayFlag(int4, _long);
                                boolean boolean7 = isoGridSquare1 != null && isoGridSquare1.getPlayerCutawayFlag(int4, _long);
                                IsoDirections isoDirections;
                                if (boolean3 && boolean4) {
                                    isoDirections = IsoDirections.NW;
                                } else if (boolean3) {
                                    isoDirections = IsoDirections.N;
                                } else if (boolean4) {
                                    isoDirections = IsoDirections.W;
                                } else {
                                    isoDirections = IsoDirections.W;
                                }

                                this.DoCutawayShaderSprite(isoObject1.sprite, isoDirections, boolean5, boolean6, boolean7);
                            }
                        }
                    }
                }
            }
        } catch (Exception exception) {
            ExceptionLogger.logException(exception);
        }

        return boolean0;
    }

    private boolean isWindowOrWindowFrame(IsoObject isoObject, boolean _boolean) {
        if (isoObject != null && isoObject.sprite != null) {
            if (_boolean && isoObject.sprite.getProperties().Is(IsoFlagType.windowN)) {
                return true;
            } else if (!_boolean && isoObject.sprite.getProperties().Is(IsoFlagType.windowW)) {
                return true;
            } else {
                IsoThumpable isoThumpable = Type.tryCastTo(isoObject, IsoThumpable.class);
                return isoThumpable != null && isoThumpable.isWindow()
                    ? _boolean == isoThumpable.getNorth()
                    : IsoWindowFrame.isWindowFrame(isoObject, _boolean);
            }
        } else {
            return false;
        }
    }

    boolean renderMinusFloor(int _int, boolean boolean1, boolean boolean2, boolean boolean3, boolean boolean4, boolean boolean5, Shader shader) {
        boolean boolean0 = false;
        if (!this.localTemporaryObjects.isEmpty()) {
            boolean0 = this.renderMinusFloor(this.localTemporaryObjects, _int, boolean1, boolean2, boolean3, boolean4, boolean5, shader);
        }

        return this.renderMinusFloor(this.Objects, _int, boolean1, boolean2, boolean3, boolean4, boolean5, shader) || boolean0;
    }

    boolean renderMinusFloor(
        PZArrayList<IsoObject> pZArrayList,
        int int8,
        boolean boolean4,
        boolean boolean13,
        boolean boolean11,
        boolean boolean9,
        boolean boolean10,
        Shader shader
    ) {
        if (!DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.RenderMinusFloor.getValue()) {
            return false;
        } else {
            zombie.IndieGL.glBlendFunc(770, 771);
            int int0 = 0;
            isOnScreenLast = this.IsOnScreen();
            int int1 = IsoCamera.frameState.playerIndex;
            IsoGridSquare isoGridSquare1 = IsoCamera.frameState.CamCharacterSquare;
            ColorInfo colorInfo = this.lightInfo[int1];
            boolean boolean0 = this.lighting[int1].bCouldSee();
            float float0 = this.lighting[int1].darkMulti();
            boolean boolean1 = IsoWorld.instance.CurrentCell.CanBuildingSquareOccludePlayer(this, int1);
            colorInfo.a = 1.0F;
            defColorInfo.r = 1.0F;
            defColorInfo.g = 1.0F;
            defColorInfo.b = 1.0F;
            defColorInfo.a = 1.0F;
            if (Core.bDebug && DebugOptions.instance.DebugDraw_SkipWorldShading.getValue()) {
                colorInfo = defColorInfo;
            }

            float float1 = this.CachedScreenX - IsoCamera.frameState.OffX;
            float float2 = this.CachedScreenY - IsoCamera.frameState.OffY;
            boolean boolean2 = true;
            IsoCell isoCell = this.getCell();
            if (float1 + (float)(32 * Core.TileScale) <= (float)isoCell.StencilX1
                || float1 - (float)(32 * Core.TileScale) >= (float)isoCell.StencilX2
                || float2 + (float)(32 * Core.TileScale) <= (float)isoCell.StencilY1
                || float2 - (float)(96 * Core.TileScale) >= (float)isoCell.StencilY2) {
                boolean2 = false;
            }

            boolean boolean3 = false;
            int int2 = pZArrayList.size();
            IsoObject[] isoObject0 = (IsoObject[])pZArrayList.getElements();
            tempWorldInventoryObjects.clear();
            int int3 = boolean4 ? int2 - 1 : 0;
            int int4 = boolean4 ? 0 : int2 - 1;
            boolean boolean5 = false;
            boolean boolean6 = false;
            boolean boolean7 = false;
            boolean boolean8 = false;
            if (!boolean4) {
                for (int int5 = int3; int5 <= int4; int5++) {
                    IsoObject isoObject1 = isoObject0[int5];
                    if (this.isWindowOrWindowFrame(isoObject1, true) && (boolean9 || boolean10)) {
                        IsoGridSquare isoGridSquare2 = this.nav[IsoDirections.N.index()];
                        boolean7 = boolean0 || isoGridSquare2 != null && isoGridSquare2.isCouldSee(int1);
                    }

                    if (this.isWindowOrWindowFrame(isoObject1, false) && (boolean9 || boolean11)) {
                        IsoGridSquare isoGridSquare3 = this.nav[IsoDirections.W.index()];
                        boolean8 = boolean0 || isoGridSquare3 != null && isoGridSquare3.isCouldSee(int1);
                    }

                    if (isoObject1.sprite != null
                        && (isoObject1.sprite.getType() == IsoObjectType.doorFrN || isoObject1.sprite.getType() == IsoObjectType.doorN)
                        && (boolean9 || boolean10)) {
                        IsoGridSquare isoGridSquare4 = this.nav[IsoDirections.N.index()];
                        boolean5 = boolean0 || isoGridSquare4 != null && isoGridSquare4.isCouldSee(int1);
                    }

                    if (isoObject1.sprite != null
                        && (isoObject1.sprite.getType() == IsoObjectType.doorFrW || isoObject1.sprite.getType() == IsoObjectType.doorW)
                        && (boolean9 || boolean11)) {
                        IsoGridSquare isoGridSquare5 = this.nav[IsoDirections.W.index()];
                        boolean6 = boolean0 || isoGridSquare5 != null && isoGridSquare5.isCouldSee(int1);
                    }
                }
            }

            int int6 = IsoWorld.instance.CurrentCell.GetEffectivePlayerRoomId();
            bWallCutawayN = false;
            bWallCutawayW = false;

            for (int int7 = int3; boolean4 ? int7 >= int4 : int7 <= int4; int7 += boolean4 ? -1 : 1) {
                IsoObject isoObject2 = isoObject0[int7];
                boolean boolean12 = true;
                IsoObjectType isoObjectType = IsoObjectType.MAX;
                if (isoObject2.sprite != null) {
                    isoObjectType = isoObject2.sprite.getType();
                }

                CircleStencil = false;
                if (isoObject2.sprite != null && (isoObject2.sprite.solidfloor || isoObject2.sprite.renderLayer == 1)) {
                    boolean12 = false;
                }

                if (isoObject2 instanceof IsoFire) {
                    boolean12 = !boolean13;
                }

                if (this.z >= int8 && (isoObject2.sprite == null || !isoObject2.sprite.alwaysDraw)) {
                    boolean12 = false;
                }

                boolean boolean14 = isoObject2.sprite != null
                    && (isoObject2.sprite.isBush || isoObject2.sprite.canBeRemoved || isoObject2.sprite.attachedFloor);
                if ((!boolean13 || boolean14 && this.bFlattenGrassEtc) && (boolean13 || !boolean14 || !this.bFlattenGrassEtc)) {
                    if (isoObject2.sprite != null
                        && (isoObjectType == IsoObjectType.WestRoofB || isoObjectType == IsoObjectType.WestRoofM || isoObjectType == IsoObjectType.WestRoofT)
                        && this.z == int8 - 1
                        && this.z == (int)IsoCamera.CamCharacter.getZ()) {
                        boolean12 = false;
                    }

                    boolean boolean15 = isoObjectType == IsoObjectType.doorFrW
                        || isoObjectType == IsoObjectType.doorW
                        || isoObject2.sprite != null && isoObject2.sprite.cutW;
                    boolean boolean16 = isoObjectType == IsoObjectType.doorFrN
                        || isoObjectType == IsoObjectType.doorN
                        || isoObject2.sprite != null && isoObject2.sprite.cutN;
                    boolean boolean17 = isoObject2 instanceof IsoDoor && ((IsoDoor)isoObject2).open
                        || isoObject2 instanceof IsoThumpable && ((IsoThumpable)isoObject2).open;
                    boolean boolean18 = isoObject2.container != null;
                    boolean boolean19 = isoObject2.sprite != null && isoObject2.sprite.getProperties().Is(IsoFlagType.waterPiped);
                    if (isoObject2.sprite != null
                        && isoObjectType == IsoObjectType.MAX
                        && !(isoObject2 instanceof IsoDoor)
                        && !(isoObject2 instanceof IsoWindow)
                        && !boolean18
                        && !boolean19) {
                        if (boolean15 || !isoObject2.sprite.getProperties().Is(IsoFlagType.attachedW) || !boolean1 && !boolean11 && !boolean9) {
                            if (!boolean16 && isoObject2.sprite.getProperties().Is(IsoFlagType.attachedN) && (boolean1 || boolean9 || boolean10)) {
                                boolean12 = !bWallCutawayN;
                            }
                        } else {
                            boolean12 = !bWallCutawayW;
                        }
                    }

                    if (isoObject2.sprite != null && !isoObject2.sprite.solidfloor && IsoPlayer.getInstance().isClimbing()) {
                        boolean12 = true;
                    }

                    if (this.isSpriteOnSouthOrEastWall(isoObject2)) {
                        if (!boolean4) {
                            boolean12 = false;
                        }

                        boolean3 = true;
                    } else if (boolean4) {
                        boolean12 = false;
                    }

                    if (boolean12) {
                        zombie.IndieGL.glAlphaFunc(516, 0.0F);
                        isoObject2.bAlphaForced = false;
                        if (boolean17) {
                            isoObject2.setTargetAlpha(int1, 0.6F);
                            isoObject2.setAlpha(int1, 0.6F);
                        }

                        if (isoObject2.sprite == null || !boolean15 && !boolean16) {
                            if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.Objects.getValue()) {
                                if (this.getRoomID() != -1
                                    && this.getRoomID() != int6
                                    && IsoPlayer.players[int1].isSeatedInVehicle()
                                    && IsoPlayer.players[int1].getVehicle().getCurrentSpeedKmHour() >= 50.0F) {
                                    break;
                                }

                                if (isoObjectType != IsoObjectType.WestRoofB
                                        && isoObjectType != IsoObjectType.WestRoofM
                                        && isoObjectType != IsoObjectType.WestRoofT
                                    || (
                                            this.getRoomID() != -1
                                                || !boolean10 && !boolean11
                                                || (!(IsoPlayer.players[int1].getX() < (float)this.x) || !(IsoPlayer.players[int1].getY() < (float)this.y))
                                                    && !(IsoPlayer.players[int1].getZ() < (float)this.z)
                                        )
                                        && (
                                            this.getRoomID() == -1 && int6 == -1
                                                || !(IsoPlayer.players[int1].getX() + IsoPlayer.players[int1].getY() <= (float)(this.x + this.y + 6))
                                                || !(IsoPlayer.players[int1].getZ() < (float)(this.z + 1))
                                        )) {
                                    if (isoGridSquare1 != null && !boolean0 && this.getRoomID() != int6 && float0 < 0.5F) {
                                        isoObject2.setTargetAlpha(int1, float0 * 2.0F);
                                    } else {
                                        if (!boolean17) {
                                            isoObject2.setTargetAlpha(int1, 1.0F);
                                        }

                                        if (IsoPlayer.getInstance() != null
                                                && isoObject2.getProperties() != null
                                                && (
                                                    isoObject2.getProperties().Is(IsoFlagType.solid)
                                                        || isoObject2.getProperties().Is(IsoFlagType.solidtrans)
                                                        || isoObject2.getProperties().Is(IsoFlagType.attachedCeiling)
                                                        || isoObject2.getSprite().getProperties().Is(IsoFlagType.attachedE)
                                                        || isoObject2.getSprite().getProperties().Is(IsoFlagType.attachedS)
                                                )
                                            || isoObjectType.index() > 2
                                                && isoObjectType.index() < 9
                                                && IsoCamera.frameState.CamCharacterZ <= isoObject2.getZ()) {
                                            byte _byte = 2;
                                            float float3 = 0.75F;
                                            if (isoObjectType.index() > 2 && isoObjectType.index() < 9
                                                || isoObject2.getSprite().getProperties().Is(IsoFlagType.attachedE)
                                                || isoObject2.getSprite().getProperties().Is(IsoFlagType.attachedS)) {
                                                _byte = 4;
                                                if (isoObjectType.index() > 2 && isoObjectType.index() < 9) {
                                                    float3 = 0.5F;
                                                }
                                            }

                                            int int9 = this.getX() - (int)IsoPlayer.getInstance().getX();
                                            int int10 = this.getY() - (int)IsoPlayer.getInstance().getY();
                                            if (int9 > 0 && int9 < _byte && int10 >= 0 && int10 < _byte
                                                || int10 > 0 && int10 < _byte && int9 >= 0 && int9 < _byte) {
                                                isoObject2.setTargetAlpha(int1, float3);
                                            }

                                            IsoZombie isoZombie = IsoCell.getInstance().getNearestVisibleZombie(int1);
                                            if (isoZombie != null && isoZombie.getCurrentSquare() != null && isoZombie.getCurrentSquare().isCanSee(int1)) {
                                                int int11 = this.getX() - (int)isoZombie.x;
                                                int int12 = this.getY() - (int)isoZombie.y;
                                                if (int11 > 0 && int11 < _byte && int12 >= 0 && int12 < _byte
                                                    || int12 > 0 && int12 < _byte && int11 >= 0 && int11 < _byte) {
                                                    isoObject2.setTargetAlpha(int1, float3);
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    isoObject2.setTargetAlpha(int1, 0.0F);
                                }

                                if (isoObject2 instanceof IsoWindow isoWindow) {
                                    if (isoObject2.getTargetAlpha(int1) < 1.0E-4F) {
                                        IsoGridSquare isoGridSquare6 = isoWindow.getOppositeSquare();
                                        if (isoGridSquare6 != null && isoGridSquare6 != this && isoGridSquare6.lighting[int1].bSeen()) {
                                            isoObject2.setTargetAlpha(int1, isoGridSquare6.lighting[int1].darkMulti() * 2.0F);
                                        }
                                    }

                                    if (isoObject2.getTargetAlpha(int1) > 0.4F
                                        && boolean9
                                        && (
                                            boolean10 && isoObject2.sprite.getProperties().Is(IsoFlagType.windowN)
                                                || boolean11 && isoObject2.sprite.getProperties().Is(IsoFlagType.windowW)
                                        )) {
                                        float float4 = 0.4F;
                                        float float5 = 0.1F;
                                        IsoPlayer isoPlayer = IsoPlayer.players[int1];
                                        if (isoPlayer != null) {
                                            float float6 = 5.0F;
                                            float float7 = Math.abs(isoPlayer.x - (float)this.x) * Math.abs(isoPlayer.x - (float)this.x)
                                                + Math.abs(isoPlayer.y - (float)this.y) * Math.abs(isoPlayer.y - (float)this.y);
                                            float float8 = float4 * (float)(1.0 - Math.sqrt((double)(float7 / float6)));
                                            isoObject2.setTargetAlpha(int1, Math.max(float8, float5));
                                        } else {
                                            isoObject2.setTargetAlpha(int1, float5);
                                        }

                                        if (boolean10) {
                                            bWallCutawayN = true;
                                        } else {
                                            bWallCutawayW = true;
                                        }
                                    }
                                }

                                if (isoObject2 instanceof IsoTree) {
                                    if (boolean2
                                        && this.x >= (int)IsoCamera.frameState.CamCharacterX
                                        && this.y >= (int)IsoCamera.frameState.CamCharacterY
                                        && isoGridSquare1 != null
                                        && isoGridSquare1.Is(IsoFlagType.exterior)) {
                                        ((IsoTree)isoObject2).bRenderFlag = true;
                                        isoObject2.setTargetAlpha(int1, Math.min(0.99F, isoObject2.getTargetAlpha(int1)));
                                    } else {
                                        ((IsoTree)isoObject2).bRenderFlag = false;
                                    }
                                }

                                IsoWorldInventoryObject isoWorldInventoryObject0 = Type.tryCastTo(isoObject2, IsoWorldInventoryObject.class);
                                if (isoWorldInventoryObject0 != null) {
                                    tempWorldInventoryObjects.add(isoWorldInventoryObject0);
                                }

                                isoObject2.render((float)this.x, (float)this.y, (float)this.z, colorInfo, true, false, null);
                            }
                        } else if (PerformanceSettings.LightingFrameSkip < 3) {
                            if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.DoorsAndWalls.getValue()) {
                                CircleStencil = true;
                                if (isoGridSquare1 != null && this.getRoomID() != -1 && int6 == -1 && boolean1) {
                                    isoObject2.setTargetAlpha(int1, 0.5F);
                                    isoObject2.setAlpha(int1, 0.5F);
                                } else if (this.getRoomID() == int6
                                    || boolean0
                                    || !isoObject2.getProperties().Is(IsoFlagType.transparentN) && !isoObject2.getProperties().Is(IsoFlagType.transparentW)) {
                                    if (!boolean17) {
                                        isoObject2.setTargetAlpha(int1, 1.0F);
                                        isoObject2.setAlpha(int1, 1.0F);
                                    }
                                } else {
                                    isoObject2.setTargetAlpha(int1, 0.0F);
                                    isoObject2.setAlpha(int1, 0.0F);
                                }

                                isoObject2.bAlphaForced = true;
                                if (isoObject2.sprite.cutW && isoObject2.sprite.cutN) {
                                    int0 = this.DoWallLightingNW(
                                        isoObject2, int0, boolean11, boolean9, boolean10, boolean5, boolean6, boolean7, boolean8, shader
                                    );
                                } else if (isoObject2.sprite.getType() == IsoObjectType.doorFrW
                                    || isoObjectType == IsoObjectType.doorW
                                    || isoObject2.sprite.cutW) {
                                    int0 = this.DoWallLightingW(isoObject2, int0, boolean11, boolean9, boolean6, boolean8, shader);
                                } else if (isoObjectType == IsoObjectType.doorFrN || isoObjectType == IsoObjectType.doorN || isoObject2.sprite.cutN) {
                                    int0 = this.DoWallLightingN(isoObject2, int0, boolean9, boolean10, boolean5, boolean7, shader);
                                }

                                if (isoObject2 instanceof IsoWindow && isoObject2.getTargetAlpha(int1) < 1.0F) {
                                    bWallCutawayN = bWallCutawayN | isoObject2.sprite.cutN;
                                    bWallCutawayW = bWallCutawayW | isoObject2.sprite.cutW;
                                }
                            }
                        } else if (DebugOptions.instance.Terrain.RenderTiles.IsoGridSquare.DoorsAndWalls_SimpleLighting.getValue()) {
                            if (this.z != (int)IsoCamera.frameState.CamCharacterZ
                                || isoObjectType == IsoObjectType.doorFrW
                                || isoObjectType == IsoObjectType.doorFrN
                                || isoObject2 instanceof IsoWindow) {
                                boolean2 = false;
                            }

                            if (isoObject2.getTargetAlpha(int1) < 1.0F) {
                                if (!boolean2) {
                                    isoObject2.setTargetAlpha(int1, 1.0F);
                                }

                                isoObject2.setAlphaToTarget(int1);
                                IsoObject.LowLightingQualityHack = false;
                                isoObject2.render((float)this.x, (float)this.y, (float)this.z, colorInfo, true, false, null);
                                if (!IsoObject.LowLightingQualityHack) {
                                    isoObject2.setTargetAlpha(int1, 1.0F);
                                }
                            } else {
                                isoObject2.render((float)this.x, (float)this.y, (float)this.z, colorInfo, true, false, null);
                            }
                        }

                        if ((isoObject2.highlightFlags & 2) != 0) {
                            isoObject2.highlightFlags &= -4;
                        }
                    }
                }
            }

            Arrays.sort(
                tempWorldInventoryObjects.getElements(),
                0,
                tempWorldInventoryObjects.size(),
                (isoWorldInventoryObject0x, isoWorldInventoryObject1x) -> {
                    float float0x = isoWorldInventoryObject0x.xoff * isoWorldInventoryObject0x.xoff
                        + isoWorldInventoryObject0x.yoff * isoWorldInventoryObject0x.yoff;
                    float float1x = isoWorldInventoryObject1x.xoff * isoWorldInventoryObject1x.xoff
                        + isoWorldInventoryObject1x.yoff * isoWorldInventoryObject1x.yoff;
                    if (float0x == float1x) {
                        return 0;
                    } else {
                        return float0x > float1x ? 1 : -1;
                    }
                }
            );

            for (int int13 = 0; int13 < tempWorldInventoryObjects.size(); int13++) {
                IsoWorldInventoryObject isoWorldInventoryObject1 = tempWorldInventoryObjects.get(int13);
                isoWorldInventoryObject1.render((float)this.x, (float)this.y, (float)this.z, colorInfo, true, false, null);
            }

            return boolean3;
        }
    }

    void RereouteWallMaskTo(IsoObject isoObject1) {
        for (int _int = 0; _int < this.Objects.size(); _int++) {
            IsoObject isoObject0 = this.Objects.get(_int);
            if (isoObject0.sprite.getProperties().Is(IsoFlagType.collideW) || isoObject0.sprite.getProperties().Is(IsoFlagType.collideN)) {
                isoObject0.rerouteMask = isoObject1;
            }
        }
    }

    void setBlockedGridPointers(IsoGridSquare.GetSquare getSquare) {
        this.w = getSquare.getGridSquare(this.x - 1, this.y, this.z);
        this.e = getSquare.getGridSquare(this.x + 1, this.y, this.z);
        this.s = getSquare.getGridSquare(this.x, this.y + 1, this.z);
        this.n = getSquare.getGridSquare(this.x, this.y - 1, this.z);
        this.ne = getSquare.getGridSquare(this.x + 1, this.y - 1, this.z);
        this.nw = getSquare.getGridSquare(this.x - 1, this.y - 1, this.z);
        this.se = getSquare.getGridSquare(this.x + 1, this.y + 1, this.z);
        this.sw = getSquare.getGridSquare(this.x - 1, this.y + 1, this.z);
        if (this.s != null && this.testPathFindAdjacent(null, this.s.x - this.x, this.s.y - this.y, this.s.z - this.z, getSquare)) {
            this.s = null;
        }

        if (this.w != null && this.testPathFindAdjacent(null, this.w.x - this.x, this.w.y - this.y, this.w.z - this.z, getSquare)) {
            this.w = null;
        }

        if (this.n != null && this.testPathFindAdjacent(null, this.n.x - this.x, this.n.y - this.y, this.n.z - this.z, getSquare)) {
            this.n = null;
        }

        if (this.e != null && this.testPathFindAdjacent(null, this.e.x - this.x, this.e.y - this.y, this.e.z - this.z, getSquare)) {
            this.e = null;
        }

        if (this.sw != null && this.testPathFindAdjacent(null, this.sw.x - this.x, this.sw.y - this.y, this.sw.z - this.z, getSquare)) {
            this.sw = null;
        }

        if (this.se != null && this.testPathFindAdjacent(null, this.se.x - this.x, this.se.y - this.y, this.se.z - this.z, getSquare)) {
            this.se = null;
        }

        if (this.nw != null && this.testPathFindAdjacent(null, this.nw.x - this.x, this.nw.y - this.y, this.nw.z - this.z, getSquare)) {
            this.nw = null;
        }

        if (this.ne != null && this.testPathFindAdjacent(null, this.ne.x - this.x, this.ne.y - this.y, this.ne.z - this.z, getSquare)) {
            this.ne = null;
        }
    }

    public IsoObject getContainerItem(String type) {
        int int0 = this.getObjects().size();
        IsoObject[] isoObject0 = this.getObjects().getElements();

        for (int int1 = 0; int1 < int0; int1++) {
            IsoObject isoObject1 = isoObject0[int1];
            if (isoObject1.getContainer() != null && type.equals(isoObject1.getContainer().getType())) {
                return isoObject1;
            }
        }

        return null;
    }

    @Deprecated
    public void StartFire() {
    }

    public void explode() {
        IsoFireManager.explode(this.getCell(), this, 100000);
    }

    public int getHourLastSeen() {
        return this.hourLastSeen;
    }

    public float getHoursSinceLastSeen() {
        return (float)zombie.GameTime.instance.getWorldAgeHours() - (float)this.hourLastSeen;
    }

    public void CalcVisibility(int playerIndex) {
        IsoPlayer isoPlayer = IsoPlayer.players[playerIndex];
        IsoGridSquare.ILighting iLighting = this.lighting[playerIndex];
        iLighting.bCanSee(false);
        iLighting.bCouldSee(false);
        if (GameServer.bServer || isoPlayer != null && (!isoPlayer.isDead() || isoPlayer.ReanimatedCorpse != null)) {
            if (isoPlayer != null) {
                IsoGameCharacter.LightInfo lightInfox = isoPlayer.getLightInfo2();
                IsoGridSquare isoGridSquare = lightInfox.square;
                if (isoGridSquare != null) {
                    IsoChunk isoChunk = this.getChunk();
                    if (isoChunk != null) {
                        tempo.x = (float)this.x + 0.5F;
                        tempo.y = (float)this.y + 0.5F;
                        tempo2.x = lightInfox.x;
                        tempo2.y = lightInfox.y;
                        tempo2.x = tempo2.x - tempo.x;
                        tempo2.y = tempo2.y - tempo.y;
                        Vector2 vector2 = tempo;
                        float float0 = tempo2.getLength();
                        tempo2.normalize();
                        if (isoPlayer instanceof IsoSurvivor) {
                            isoPlayer.setForwardDirection(vector2);
                            lightInfox.angleX = vector2.x;
                            lightInfox.angleY = vector2.y;
                        }

                        vector2.x = lightInfox.angleX;
                        vector2.y = lightInfox.angleY;
                        vector2.normalize();
                        float float1 = tempo2.dot(vector2);
                        if (isoGridSquare == this) {
                            float1 = -1.0F;
                        }

                        if (!GameServer.bServer) {
                            float float2 = isoPlayer.getStats().fatigue - 0.6F;
                            if (float2 < 0.0F) {
                                float2 = 0.0F;
                            }

                            float2 *= 2.5F;
                            if (isoPlayer.Traits.HardOfHearing.isSet() && float2 < 0.7F) {
                                float2 = 0.7F;
                            }

                            float float3 = 2.0F;
                            if (isoPlayer.Traits.KeenHearing.isSet()) {
                                float3 += 3.0F;
                            }

                            if (float0 < float3 * (1.0F - float2) && !isoPlayer.Traits.Deaf.isSet()) {
                                float1 = -1.0F;
                            }
                        }

                        LosUtil.TestResults testResults = LosUtil.lineClearCached(
                            this.getCell(), this.x, this.y, this.z, (int)lightInfox.x, (int)lightInfox.y, (int)lightInfox.z, false, playerIndex
                        );
                        float float4 = -0.2F;
                        float4 -= isoPlayer.getStats().fatigue - 0.6F;
                        if (float4 > -0.2F) {
                            float4 = -0.2F;
                        }

                        if (isoPlayer.getStats().fatigue >= 1.0F) {
                            float4 -= 0.2F;
                        }

                        if (isoPlayer.getMoodles().getMoodleLevel(MoodleType.Panic) == 4) {
                            float4 -= 0.2F;
                        }

                        if (float4 < -0.9F) {
                            float4 = -0.9F;
                        }

                        if (isoPlayer.Traits.EagleEyed.isSet()) {
                            float4 += 0.2F;
                        }

                        if (isoPlayer instanceof IsoPlayer && isoPlayer.getVehicle() != null) {
                            float4 = 1.0F;
                        }

                        if (!(float1 > float4) && testResults != LosUtil.TestResults.Blocked) {
                            iLighting.bCouldSee(true);
                            if (this.room != null && this.room.def != null && !this.room.def.bExplored) {
                                byte _byte = 10;
                                if (lightInfox.square != null && lightInfox.square.getBuilding() == this.room.building) {
                                    _byte = 50;
                                }

                                if ((!GameServer.bServer || !(isoPlayer instanceof IsoPlayer) || !isoPlayer.isGhostMode())
                                    && IsoUtils.DistanceManhatten(lightInfox.x, lightInfox.y, (float)this.x, (float)this.y) < (float)_byte
                                    && this.z == (int)lightInfox.z) {
                                    if (GameServer.bServer) {
                                        DebugLog.log(DebugType.Zombie, "bExplored room=" + this.room.def.ID);
                                    }

                                    this.room.def.bExplored = true;
                                    this.room.onSee();
                                    this.room.seen = 0;
                                }
                            }

                            if (!GameClient.bClient) {
                                Meta.instance.dealWithSquareSeen(this);
                            }

                            iLighting.bCanSee(true);
                            iLighting.bSeen(true);
                            iLighting.targetDarkMulti(1.0F);
                        } else {
                            if (testResults == LosUtil.TestResults.Blocked) {
                                iLighting.bCouldSee(false);
                            } else {
                                iLighting.bCouldSee(true);
                            }

                            if (!GameServer.bServer) {
                                if (iLighting.bSeen()) {
                                    float float5 = RenderSettings.getInstance().getAmbientForPlayer(IsoPlayer.getPlayerIndex());
                                    if (!iLighting.bCouldSee()) {
                                        float5 *= 0.5F;
                                    } else {
                                        float5 *= 0.94F;
                                    }

                                    if (this.room == null && isoGridSquare.getRoom() == null) {
                                        iLighting.targetDarkMulti(float5);
                                    } else if (this.room != null && isoGridSquare.getRoom() != null && this.room.building == isoGridSquare.getRoom().building) {
                                        if (this.room != isoGridSquare.getRoom() && !iLighting.bCouldSee()) {
                                            iLighting.targetDarkMulti(0.0F);
                                        } else {
                                            iLighting.targetDarkMulti(float5);
                                        }
                                    } else if (this.room == null) {
                                        iLighting.targetDarkMulti(float5 / 2.0F);
                                    } else if (iLighting.lampostTotalR() + iLighting.lampostTotalG() + iLighting.lampostTotalB() == 0.0F) {
                                        iLighting.targetDarkMulti(0.0F);
                                    }

                                    if (this.room != null) {
                                        iLighting.targetDarkMulti(iLighting.targetDarkMulti() * 0.7F);
                                    }
                                } else {
                                    iLighting.targetDarkMulti(0.0F);
                                    iLighting.darkMulti(0.0F);
                                }
                            }
                        }

                        if (float1 > float4) {
                            iLighting.targetDarkMulti(iLighting.targetDarkMulti() * 0.85F);
                        }

                        if (!GameServer.bServer) {
                            for (int _int = 0; _int < lightInfox.torches.size(); _int++) {
                                IsoGameCharacter.TorchInfo torchInfo = (IsoGameCharacter.TorchInfo)lightInfox.torches.get(_int);
                                tempo2.x = torchInfo.x;
                                tempo2.y = torchInfo.y;
                                tempo2.x = tempo2.x - ((float)this.x + 0.5F);
                                tempo2.y = tempo2.y - ((float)this.y + 0.5F);
                                float0 = tempo2.getLength();
                                tempo2.normalize();
                                vector2.x = torchInfo.angleX;
                                vector2.y = torchInfo.angleY;
                                vector2.normalize();
                                float1 = tempo2.dot(vector2);
                                if ((int)torchInfo.x == this.getX() && (int)torchInfo.y == this.getY() && (int)torchInfo.z == this.getZ()) {
                                    float1 = -1.0F;
                                }

                                boolean _boolean = false;
                                if (IsoUtils.DistanceManhatten((float)this.getX(), (float)this.getY(), torchInfo.x, torchInfo.y) < torchInfo.dist
                                    && (torchInfo.bCone && float1 < -torchInfo.dot || float1 == -1.0F || !torchInfo.bCone && float1 < 0.8F)) {
                                    _boolean = true;
                                }

                                if ((torchInfo.bCone && float0 < torchInfo.dist || !torchInfo.bCone && float0 < torchInfo.dist)
                                    && iLighting.bCanSee()
                                    && _boolean
                                    && this.z == (int)isoPlayer.getZ()) {
                                    float float6 = float0 / torchInfo.dist;
                                    if (float6 > 1.0F) {
                                        float6 = 1.0F;
                                    }

                                    if (float6 < 0.0F) {
                                        float6 = 0.0F;
                                    }

                                    iLighting.targetDarkMulti(iLighting.targetDarkMulti() + torchInfo.strength * (1.0F - float6) * 3.0F);
                                    if (iLighting.targetDarkMulti() > 2.5F) {
                                        iLighting.targetDarkMulti(2.5F);
                                    }

                                    torchTimer = lightInfox.time;
                                }
                            }
                        }
                    }
                }
            }
        } else {
            iLighting.bSeen(true);
            iLighting.bCanSee(true);
            iLighting.bCouldSee(true);
        }
    }

    private LosUtil.TestResults DoDiagnalCheck(int int0, int int2, int int1, boolean _boolean) {
        LosUtil.TestResults testResults0 = this.testVisionAdjacent(int0, 0, int1, false, _boolean);
        if (testResults0 == LosUtil.TestResults.Blocked) {
            return LosUtil.TestResults.Blocked;
        } else {
            LosUtil.TestResults testResults1 = this.testVisionAdjacent(0, int2, int1, false, _boolean);
            if (testResults1 == LosUtil.TestResults.Blocked) {
                return LosUtil.TestResults.Blocked;
            } else {
                return testResults0 != LosUtil.TestResults.ClearThroughWindow && testResults1 != LosUtil.TestResults.ClearThroughWindow
                    ? this.testVisionAdjacent(int0, int2, int1, false, _boolean)
                    : LosUtil.TestResults.ClearThroughWindow;
            }
        }
    }

    boolean HasNoCharacters() {
        for (int int0 = 0; int0 < this.MovingObjects.size(); int0++) {
            if (this.MovingObjects.get(int0) instanceof IsoGameCharacter) {
                return false;
            }
        }

        for (int int1 = 0; int1 < this.SpecialObjects.size(); int1++) {
            if (this.SpecialObjects.get(int1) instanceof IsoBarricade) {
                return false;
            }
        }

        return true;
    }

    public IsoZombie getZombie() {
        for (int _int = 0; _int < this.MovingObjects.size(); _int++) {
            if (this.MovingObjects.get(_int) instanceof IsoZombie) {
                return (IsoZombie)this.MovingObjects.get(_int);
            }
        }

        return null;
    }

    public IsoPlayer getPlayer() {
        for (int _int = 0; _int < this.MovingObjects.size(); _int++) {
            if (this.MovingObjects.get(_int) instanceof IsoPlayer) {
                return (IsoPlayer)this.MovingObjects.get(_int);
            }
        }

        return null;
    }

    public static float getDarkStep() {
        return darkStep;
    }

    public static void setDarkStep(float aDarkStep) {
        darkStep = aDarkStep;
    }

    public static int getRecalcLightTime() {
        return RecalcLightTime;
    }

    public static void setRecalcLightTime(int aRecalcLightTime) {
        RecalcLightTime = aRecalcLightTime;
    }

    public static int getLightcache() {
        return lightcache;
    }

    public static void setLightcache(int aLightcache) {
        lightcache = aLightcache;
    }

    public boolean isCouldSee(int playerIndex) {
        return this.lighting[playerIndex].bCouldSee();
    }

    public void setCouldSee(int playerIndex, boolean bCouldSee) {
        this.lighting[playerIndex].bCouldSee(bCouldSee);
    }

    public boolean isCanSee(int playerIndex) {
        return this.lighting[playerIndex].bCanSee();
    }

    public void setCanSee(int playerIndex, boolean canSee) {
        this.lighting[playerIndex].bCanSee(canSee);
    }

    public IsoCell getCell() {
        return IsoWorld.instance.CurrentCell;
    }

    public IsoGridSquare getE() {
        return this.e;
    }

    public void setE(IsoGridSquare _e) {
        this.e = _e;
    }

    public ArrayList<Float> getLightInfluenceB() {
        return this.LightInfluenceB;
    }

    public void setLightInfluenceB(ArrayList<Float> _LightInfluenceB) {
        this.LightInfluenceB = _LightInfluenceB;
    }

    public ArrayList<Float> getLightInfluenceG() {
        return this.LightInfluenceG;
    }

    public void setLightInfluenceG(ArrayList<Float> _LightInfluenceG) {
        this.LightInfluenceG = _LightInfluenceG;
    }

    public ArrayList<Float> getLightInfluenceR() {
        return this.LightInfluenceR;
    }

    public void setLightInfluenceR(ArrayList<Float> _LightInfluenceR) {
        this.LightInfluenceR = _LightInfluenceR;
    }

    public ArrayList<IsoMovingObject> getStaticMovingObjects() {
        return this.StaticMovingObjects;
    }

    public ArrayList<IsoMovingObject> getMovingObjects() {
        return this.MovingObjects;
    }

    public IsoGridSquare getN() {
        return this.n;
    }

    public void setN(IsoGridSquare _n) {
        this.n = _n;
    }

    public PZArrayList<IsoObject> getObjects() {
        return this.Objects;
    }

    public PropertyContainer getProperties() {
        return this.Properties;
    }

    public IsoRoom getRoom() {
        return this.roomID == -1 ? null : this.room;
    }

    public void setRoom(IsoRoom _room) {
        this.room = _room;
    }

    public IsoBuilding getBuilding() {
        IsoRoom isoRoom = this.getRoom();
        return isoRoom != null ? isoRoom.getBuilding() : null;
    }

    public IsoGridSquare getS() {
        return this.s;
    }

    public void setS(IsoGridSquare _s) {
        this.s = _s;
    }

    public ArrayList<IsoObject> getSpecialObjects() {
        return this.SpecialObjects;
    }

    public IsoGridSquare getW() {
        return this.w;
    }

    public void setW(IsoGridSquare _w) {
        this.w = _w;
    }

    public float getLampostTotalR() {
        return this.lighting[0].lampostTotalR();
    }

    public void setLampostTotalR(float lampostTotalR) {
        this.lighting[0].lampostTotalR(lampostTotalR);
    }

    public float getLampostTotalG() {
        return this.lighting[0].lampostTotalG();
    }

    public void setLampostTotalG(float lampostTotalG) {
        this.lighting[0].lampostTotalG(lampostTotalG);
    }

    public float getLampostTotalB() {
        return this.lighting[0].lampostTotalB();
    }

    public void setLampostTotalB(float lampostTotalB) {
        this.lighting[0].lampostTotalB(lampostTotalB);
    }

    public boolean isSeen(int playerIndex) {
        return this.lighting[playerIndex].bSeen();
    }

    public void setIsSeen(int playerIndex, boolean bSeen) {
        this.lighting[playerIndex].bSeen(bSeen);
    }

    public float getDarkMulti(int playerIndex) {
        return this.lighting[playerIndex].darkMulti();
    }

    public void setDarkMulti(int playerIndex, float darkMulti) {
        this.lighting[playerIndex].darkMulti(darkMulti);
    }

    public float getTargetDarkMulti(int playerIndex) {
        return this.lighting[playerIndex].targetDarkMulti();
    }

    public void setTargetDarkMulti(int playerIndex, float targetDarkMulti) {
        this.lighting[playerIndex].targetDarkMulti(targetDarkMulti);
    }

    public void setX(int _x) {
        this.x = _x;
        this.CachedScreenValue = -1;
    }

    public void setY(int _y) {
        this.y = _y;
        this.CachedScreenValue = -1;
    }

    public void setZ(int _z) {
        this.z = _z;
        this.CachedScreenValue = -1;
    }

    public ArrayList<IsoGameCharacter> getDeferedCharacters() {
        return this.DeferedCharacters;
    }

    public void addDeferredCharacter(IsoGameCharacter chr) {
        if (this.DeferredCharacterTick != this.getCell().DeferredCharacterTick) {
            if (!this.DeferedCharacters.isEmpty()) {
                this.DeferedCharacters.clear();
            }

            this.DeferredCharacterTick = this.getCell().DeferredCharacterTick;
        }

        this.DeferedCharacters.add(chr);
    }

    public boolean isCacheIsFree() {
        return this.CacheIsFree;
    }

    public void setCacheIsFree(boolean _CacheIsFree) {
        this.CacheIsFree = _CacheIsFree;
    }

    public boolean isCachedIsFree() {
        return this.CachedIsFree;
    }

    public void setCachedIsFree(boolean _CachedIsFree) {
        this.CachedIsFree = _CachedIsFree;
    }

    public static boolean isbDoSlowPathfinding() {
        return bDoSlowPathfinding;
    }

    public static void setbDoSlowPathfinding(boolean abDoSlowPathfinding) {
        bDoSlowPathfinding = abDoSlowPathfinding;
    }

    public boolean isSolidFloorCached() {
        return this.SolidFloorCached;
    }

    public void setSolidFloorCached(boolean _SolidFloorCached) {
        this.SolidFloorCached = _SolidFloorCached;
    }

    public boolean isSolidFloor() {
        return this.SolidFloor;
    }

    public void setSolidFloor(boolean _SolidFloor) {
        this.SolidFloor = _SolidFloor;
    }

    public static ColorInfo getDefColorInfo() {
        return defColorInfo;
    }

    public boolean isOutside() {
        return this.Properties.Is(IsoFlagType.exterior);
    }

    public boolean HasPushable() {
        int int0 = this.MovingObjects.size();

        for (int int1 = 0; int1 < int0; int1++) {
            if (this.MovingObjects.get(int1) instanceof IsoPushableObject) {
                return true;
            }
        }

        return false;
    }

    public void setRoomID(int _roomID) {
        this.roomID = _roomID;
        if (_roomID != -1) {
            this.getProperties().UnSet(IsoFlagType.exterior);
            this.room = this.chunk.getRoom(_roomID);
        }
    }

    public int getRoomID() {
        return this.roomID;
    }

    public boolean getCanSee(int playerIndex) {
        return this.lighting[playerIndex].bCanSee();
    }

    public boolean getSeen(int playerIndex) {
        return this.lighting[playerIndex].bSeen();
    }

    public IsoChunk getChunk() {
        return this.chunk;
    }

    public IsoObject getDoorOrWindow(boolean north) {
        for (int _int = this.SpecialObjects.size() - 1; _int >= 0; _int--) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            if (isoObject instanceof IsoDoor && ((IsoDoor)isoObject).north == north) {
                return isoObject;
            }

            if (isoObject instanceof IsoThumpable
                && ((IsoThumpable)isoObject).north == north
                && (((IsoThumpable)isoObject).isDoor() || ((IsoThumpable)isoObject).isWindow())) {
                return isoObject;
            }

            if (isoObject instanceof IsoWindow && ((IsoWindow)isoObject).north == north) {
                return isoObject;
            }
        }

        return null;
    }

    public IsoObject getDoorOrWindowOrWindowFrame(IsoDirections dir, boolean ignoreOpen) {
        for (int _int = this.Objects.size() - 1; _int >= 0; _int--) {
            IsoObject isoObject = this.Objects.get(_int);
            IsoDoor isoDoor = Type.tryCastTo(isoObject, IsoDoor.class);
            IsoThumpable isoThumpable = Type.tryCastTo(isoObject, IsoThumpable.class);
            IsoWindow isoWindow = Type.tryCastTo(isoObject, IsoWindow.class);
            if (isoDoor != null && isoDoor.getSpriteEdge(ignoreOpen) == dir) {
                return isoObject;
            }

            if (isoThumpable != null && isoThumpable.getSpriteEdge(ignoreOpen) == dir) {
                return isoObject;
            }

            if (isoWindow != null) {
                if (isoWindow.north && dir == IsoDirections.N) {
                    return isoObject;
                }

                if (!isoWindow.north && dir == IsoDirections.W) {
                    return isoObject;
                }
            }

            if (IsoWindowFrame.isWindowFrame(isoObject)) {
                if (IsoWindowFrame.isWindowFrame(isoObject, true) && dir == IsoDirections.N) {
                    return isoObject;
                }

                if (IsoWindowFrame.isWindowFrame(isoObject, false) && dir == IsoDirections.W) {
                    return isoObject;
                }
            }
        }

        return null;
    }

    public IsoObject getOpenDoor(IsoDirections dir) {
        for (int _int = 0; _int < this.SpecialObjects.size(); _int++) {
            IsoObject isoObject = (IsoObject)this.SpecialObjects.get(_int);
            IsoDoor isoDoor = Type.tryCastTo(isoObject, IsoDoor.class);
            IsoThumpable isoThumpable = Type.tryCastTo(isoObject, IsoThumpable.class);
            if (isoDoor != null && isoDoor.open && isoDoor.getSpriteEdge(false) == dir) {
                return isoDoor;
            }

            if (isoThumpable != null && isoThumpable.open && isoThumpable.getSpriteEdge(false) == dir) {
                return isoThumpable;
            }
        }

        return null;
    }

    public void removeWorldObject(IsoWorldInventoryObject object) {
        if (object != null) {
            object.removeFromWorld();
            object.removeFromSquare();
        }
    }

    public void removeAllWorldObjects() {
        for (int _int = 0; _int < this.getWorldObjects().size(); _int++) {
            IsoObject isoObject = (IsoObject)this.getWorldObjects().get(_int);
            isoObject.removeFromWorld();
            isoObject.removeFromSquare();
            _int--;
        }
    }

    public ArrayList<IsoWorldInventoryObject> getWorldObjects() {
        return this.WorldObjects;
    }

    public PZArrayList<IsoObject> getLocalTemporaryObjects() {
        return this.localTemporaryObjects;
    }

    public KahluaTable getModData() {
        if (this.table == null) {
            this.table = LuaManager.platform.newTable();
        }

        return this.table;
    }

    public boolean hasModData() {
        return this.table != null && !this.table.isEmpty();
    }

    public zombie.ZomboidBitFlag getHasTypes() {
        return this.hasTypes;
    }

    public void setVertLight(int i, int _col, int playerIndex) {
        this.lighting[playerIndex].lightverts(i, _col);
    }

    public int getVertLight(int i, int playerIndex) {
        return this.lighting[playerIndex].lightverts(i);
    }

    public void setRainDrop(IsoRaindrop drop) {
        this.RainDrop = drop;
    }

    public IsoRaindrop getRainDrop() {
        return this.RainDrop;
    }

    public void setRainSplash(IsoRainSplash splash) {
        this.RainSplash = splash;
    }

    public IsoRainSplash getRainSplash() {
        return this.RainSplash;
    }

    public IsoMetaGrid.Zone getZone() {
        return this.zone;
    }

    public String getZoneType() {
        return this.zone != null ? this.zone.getType() : null;
    }

    public boolean isOverlayDone() {
        return this.overlayDone;
    }

    public void setOverlayDone(boolean _overlayDone) {
        this.overlayDone = _overlayDone;
    }

    public ErosionData.Square getErosionData() {
        if (this.erosion == null) {
            this.erosion = new ErosionData.Square();
        }

        return this.erosion;
    }

    public void disableErosion() {
        ErosionData.Square square = this.getErosionData();
        if (square != null && !square.doNothing) {
            square.doNothing = true;
        }
    }

    public void removeErosionObject(String type) {
        if (this.erosion != null) {
            if ("WallVines".equals(type)) {
                for (int _int = 0; _int < this.erosion.regions.size(); _int++) {
                    ErosionCategory.Data data = (ErosionCategory.Data)this.erosion.regions.get(_int);
                    if (data.regionID == 2 && data.categoryID == 0) {
                        this.erosion.regions.remove(_int);
                        break;
                    }
                }
            }
        }
    }

    public void syncIsoTrap(HandWeapon weapon) {
        ByteBufferWriter byteBufferWriter = GameClient.connection.startPacket();
        PacketTypes.PacketType.AddExplosiveTrap.doPacket(byteBufferWriter);
        byteBufferWriter.putInt(this.getX());
        byteBufferWriter.putInt(this.getY());
        byteBufferWriter.putInt(this.getZ());

        try {
            weapon.saveWithSize(byteBufferWriter.bb, false);
        } catch (Exception exception) {
            ExceptionLogger.logException(exception);
        }

        PacketTypes.PacketType.AddExplosiveTrap.send(GameClient.connection);
    }

    public void drawCircleExplosion(int radius, IsoTrap trap, IsoTrap.ExplosionMode explosionMode) {
        if (radius > 15) {
            radius = 15;
        }

        for (int int0 = this.getX() - radius; int0 <= this.getX() + radius; int0++) {
            for (int int1 = this.getY() - radius; int1 <= this.getY() + radius; int1++) {
                if (!(IsoUtils.DistanceTo((float)int0 + 0.5F, (float)int1 + 0.5F, (float)this.getX() + 0.5F, (float)this.getY() + 0.5F) > (float)radius)) {
                    LosUtil.TestResults testResults = LosUtil.lineClear(
                        this.getCell(), (int)trap.getX(), (int)trap.getY(), (int)trap.getZ(), int0, int1, this.z, false
                    );
                    if (testResults != LosUtil.TestResults.Blocked && testResults != LosUtil.TestResults.ClearThroughClosedDoor) {
                        IsoGridSquare isoGridSquare = this.getCell().getGridSquare(int0, int1, this.getZ());
                        if (isoGridSquare != null && NonPvpZone.getNonPvpZone(isoGridSquare.getX(), isoGridSquare.getY()) == null) {
                            if (explosionMode == IsoTrap.ExplosionMode.Smoke) {
                                if (!GameClient.bClient && Rand.Next(2) == 0) {
                                    IsoFireManager.StartSmoke(this.getCell(), isoGridSquare, true, 40, 0);
                                }

                                isoGridSquare.smoke();
                            }

                            if (explosionMode == IsoTrap.ExplosionMode.Explosion) {
                                if (!GameClient.bClient && trap.getExplosionPower() > 0 && Rand.Next(80 - trap.getExplosionPower()) <= 0) {
                                    isoGridSquare.Burn();
                                }

                                isoGridSquare.explosion(trap);
                                if (!GameClient.bClient && trap.getExplosionPower() > 0 && Rand.Next(100 - trap.getExplosionPower()) == 0) {
                                    IsoFireManager.StartFire(this.getCell(), isoGridSquare, true, 20);
                                }
                            }

                            if (explosionMode == IsoTrap.ExplosionMode.Fire && !GameClient.bClient && Rand.Next(100 - trap.getFirePower()) == 0) {
                                IsoFireManager.StartFire(this.getCell(), isoGridSquare, true, 40);
                            }

                            if (explosionMode == IsoTrap.ExplosionMode.Sensor) {
                                isoGridSquare.setTrapPositionX(this.getX());
                                isoGridSquare.setTrapPositionY(this.getY());
                                isoGridSquare.setTrapPositionZ(this.getZ());
                            }
                        }
                    }
                }
            }
        }
    }

    public void explosion(IsoTrap trap) {
        if (!GameServer.bServer || !trap.isInstantExplosion()) {
            for (int int0 = 0; int0 < this.getMovingObjects().size(); int0++) {
                IsoMovingObject isoMovingObject = (IsoMovingObject)this.getMovingObjects().get(int0);
                if (isoMovingObject instanceof IsoGameCharacter) {
                    if (GameServer.bServer || !(isoMovingObject instanceof IsoZombie) || ((IsoZombie)isoMovingObject).isLocal()) {
                        int int1 = Math.min(trap.getExplosionPower(), 80);
                        isoMovingObject.Hit(
                            (HandWeapon)InventoryItemFactory.CreateItem("Base.Axe"),
                            IsoWorld.instance.CurrentCell.getFakeZombieForHit(),
                            Rand.Next((float)int1 / 30.0F, (float)int1 / 30.0F * 2.0F) + trap.getExtraDamage(),
                            false,
                            1.0F
                        );
                        if (trap.getExplosionPower() > 0) {
                            boolean _boolean = !(isoMovingObject instanceof IsoZombie);

                            while (_boolean) {
                                _boolean = false;
                                BodyPart bodyPart = ((IsoGameCharacter)isoMovingObject).getBodyDamage().getBodyPart(BodyPartType.FromIndex(Rand.Next(15)));
                                bodyPart.setBurned();
                                if (Rand.Next((100 - int1) / 2) == 0) {
                                    _boolean = true;
                                }
                            }
                        }
                    }

                    if (GameClient.bClient && isoMovingObject instanceof IsoZombie && ((IsoZombie)isoMovingObject).isRemoteZombie()) {
                        isoMovingObject.Hit(
                            (HandWeapon)InventoryItemFactory.CreateItem("Base.Axe"), IsoWorld.instance.CurrentCell.getFakeZombieForHit(), 0.0F, true, 0.0F
                        );
                    }
                }
            }
        }
    }

    public void smoke() {
        for (int _int = 0; _int < this.getMovingObjects().size(); _int++) {
            IsoMovingObject isoMovingObject = (IsoMovingObject)this.getMovingObjects().get(_int);
            if (isoMovingObject instanceof IsoZombie) {
                ((IsoZombie)isoMovingObject).setTarget(null);
                ((IsoZombie)isoMovingObject).changeState(ZombieIdleState.instance());
            }
        }
    }

    public void explodeTrap() {
        IsoGridSquare isoGridSquare0 = this.getCell().getGridSquare(this.getTrapPositionX(), this.getTrapPositionY(), this.getTrapPositionZ());
        if (isoGridSquare0 != null) {
            for (int int0 = 0; int0 < isoGridSquare0.getObjects().size(); int0++) {
                IsoObject isoObject = isoGridSquare0.getObjects().get(int0);
                if (isoObject instanceof IsoTrap isoTrap) {
                    isoTrap.triggerExplosion(false);
                    IsoGridSquare isoGridSquare2 = null;
                    int int1 = isoTrap.getSensorRange();

                    for (int int2 = isoGridSquare0.getX() - int1; int2 <= isoGridSquare0.getX() + int1; int2++) {
                        for (int int3 = isoGridSquare0.getY() - int1; int3 <= isoGridSquare0.getY() + int1; int3++) {
                            if (IsoUtils.DistanceTo(
                                    (float)int2 + 0.5F, (float)int3 + 0.5F, (float)isoGridSquare0.getX() + 0.5F, (float)isoGridSquare0.getY() + 0.5F
                                )
                                <= (float)int1) {
                                isoGridSquare2 = this.getCell().getGridSquare(int2, int3, this.getZ());
                                if (isoGridSquare2 != null) {
                                    isoGridSquare2.setTrapPositionX(-1);
                                    isoGridSquare2.setTrapPositionY(-1);
                                    isoGridSquare2.setTrapPositionZ(-1);
                                }
                            }
                        }
                    }

                    return;
                }
            }
        }
    }

    public int getTrapPositionX() {
        return this.trapPositionX;
    }

    public void setTrapPositionX(int _trapPositionX) {
        this.trapPositionX = _trapPositionX;
    }

    public int getTrapPositionY() {
        return this.trapPositionY;
    }

    public void setTrapPositionY(int _trapPositionY) {
        this.trapPositionY = _trapPositionY;
    }

    public int getTrapPositionZ() {
        return this.trapPositionZ;
    }

    public void setTrapPositionZ(int _trapPositionZ) {
        this.trapPositionZ = _trapPositionZ;
    }

    public boolean haveElectricity() {
        if ((this.chunk == null || !this.chunk.bLoaded) && this.haveElectricity) {
            return true;
        } else {
            return !zombie.SandboxOptions.getInstance().AllowExteriorGenerator.getValue() && this.Is(IsoFlagType.exterior)
                ? false
                : this.chunk != null && this.chunk.isGeneratorPoweringSquare(this.x, this.y, this.z);
        }
    }

    public void setHaveElectricity(boolean _haveElectricity) {
        if (!_haveElectricity) {
            this.haveElectricity = false;
        }

        if (this.getObjects() != null) {
            for (int _int = 0; _int < this.getObjects().size(); _int++) {
                if (this.getObjects().get(_int) instanceof IsoLightSwitch) {
                    ((IsoLightSwitch)this.getObjects().get(_int)).update();
                }
            }
        }
    }

    public IsoGenerator getGenerator() {
        if (this.getSpecialObjects() != null) {
            for (int _int = 0; _int < this.getSpecialObjects().size(); _int++) {
                if (this.getSpecialObjects().get(_int) instanceof IsoGenerator) {
                    return (IsoGenerator)this.getSpecialObjects().get(_int);
                }
            }
        }

        return null;
    }

    public void stopFire() {
        IsoFireManager.RemoveAllOn(this);
        this.getProperties().Set(IsoFlagType.burntOut);
        this.getProperties().UnSet(IsoFlagType.burning);
        this.burntOut = true;
    }

    public void transmitStopFire() {
        if (GameClient.bClient) {
            GameClient.sendStopFire(this);
        }
    }

    public long playSound(String file) {
        BaseSoundEmitter baseSoundEmitter = IsoWorld.instance.getFreeEmitter((float)this.x + 0.5F, (float)this.y + 0.5F, (float)this.z);
        return baseSoundEmitter.playSound(file);
    }

    @Deprecated
    public long playSound(String file, boolean doWorldSound) {
        BaseSoundEmitter baseSoundEmitter = IsoWorld.instance.getFreeEmitter((float)this.x + 0.5F, (float)this.y + 0.5F, (float)this.z);
        return baseSoundEmitter.playSound(file, doWorldSound);
    }

    public void FixStackableObjects() {
        IsoObject isoObject0 = null;

        for (int int0 = 0; int0 < this.Objects.size(); int0++) {
            IsoObject isoObject1 = this.Objects.get(int0);
            if (!(isoObject1 instanceof IsoWorldInventoryObject) && isoObject1.sprite != null) {
                PropertyContainer propertyContainer0 = isoObject1.sprite.getProperties();
                if (propertyContainer0.getStackReplaceTileOffset() != 0) {
                    isoObject1.sprite = IsoSprite.getSprite(IsoSpriteManager.instance, isoObject1.sprite.ID + propertyContainer0.getStackReplaceTileOffset());
                    if (isoObject1.sprite == null) {
                        continue;
                    }

                    propertyContainer0 = isoObject1.sprite.getProperties();
                }

                if (propertyContainer0.isTable() || propertyContainer0.isTableTop()) {
                    float _float = propertyContainer0.isSurfaceOffset() ? (float)propertyContainer0.getSurface() : 0.0F;
                    if (isoObject0 != null) {
                        isoObject1.setRenderYOffset(isoObject0.getRenderYOffset() + isoObject0.getSurfaceOffset() - _float);
                    } else {
                        isoObject1.setRenderYOffset(0.0F - _float);
                    }
                }

                if (propertyContainer0.isTable()) {
                    isoObject0 = isoObject1;
                }

                if (isoObject1 instanceof IsoLightSwitch
                    && propertyContainer0.isTableTop()
                    && isoObject0 != null
                    && !propertyContainer0.Is("IgnoreSurfaceSnap")) {
                    int int1 = PZMath.tryParseInt(propertyContainer0.Val("Noffset"), 0);
                    int int2 = PZMath.tryParseInt(propertyContainer0.Val("Soffset"), 0);
                    int int3 = PZMath.tryParseInt(propertyContainer0.Val("Woffset"), 0);
                    int int4 = PZMath.tryParseInt(propertyContainer0.Val("Eoffset"), 0);
                    String string0 = propertyContainer0.Val("Facing");
                    PropertyContainer propertyContainer1 = isoObject0.getProperties();
                    String string1 = propertyContainer1.Val("Facing");
                    if (!StringUtils.isNullOrWhitespace(string1) && !string1.equals(string0)) {
                        int int5 = 0;
                        if ("N".equals(string1)) {
                            if (int1 != 0) {
                                int5 = int1;
                            } else if (int2 != 0) {
                                int5 = int2;
                            }
                        } else if ("S".equals(string1)) {
                            if (int2 != 0) {
                                int5 = int2;
                            } else if (int1 != 0) {
                                int5 = int1;
                            }
                        } else if ("W".equals(string1)) {
                            if (int3 != 0) {
                                int5 = int3;
                            } else if (int4 != 0) {
                                int5 = int4;
                            }
                        } else if ("E".equals(string1)) {
                            if (int4 != 0) {
                                int5 = int4;
                            } else if (int3 != 0) {
                                int5 = int3;
                            }
                        }

                        if (int5 != 0) {
                            IsoSprite isoSprite = IsoSpriteManager.instance.getSprite(isoObject1.sprite.ID + int5);
                            if (isoSprite != null) {
                                isoObject1.setSprite(isoSprite);
                            }
                        }
                    }
                }
            }
        }
    }

    public void fixPlacedItemRenderOffsets() {
        IsoObject[] isoObject0 = this.Objects.getElements();
        int int0 = this.Objects.size();
        int int1 = 0;

        for (int int2 = 0; int2 < int0; int2++) {
            IsoObject isoObject1 = isoObject0[int2];
            int int3 = PZMath.roundToInt(isoObject1.getSurfaceOffsetNoTable());
            if (!((float)int3 <= 0.0F) && !PZArrayUtil.contains(SURFACE_OFFSETS, int1, int3)) {
                SURFACE_OFFSETS[int1++] = int3;
            }
        }

        if (int1 == 0) {
            SURFACE_OFFSETS[int1++] = 0;
        }

        for (int int4 = 0; int4 < int0; int4++) {
            IsoObject isoObject2 = isoObject0[int4];
            IsoWorldInventoryObject isoWorldInventoryObject = Type.tryCastTo(isoObject2, IsoWorldInventoryObject.class);
            if (isoWorldInventoryObject != null) {
                int int5 = PZMath.roundToInt(isoWorldInventoryObject.zoff * 96.0F);
                int int6 = 0;

                for (int int7 = 0; int7 < int1; int7++) {
                    if (int5 <= SURFACE_OFFSETS[int7]) {
                        int6 = SURFACE_OFFSETS[int7];
                        break;
                    }

                    int6 = SURFACE_OFFSETS[int7];
                    if (int7 < int1 - 1 && int5 < SURFACE_OFFSETS[int7 + 1]) {
                        break;
                    }
                }

                isoWorldInventoryObject.zoff = (float)int6 / 96.0F;
            }
        }
    }

    public BaseVehicle getVehicleContainer() {
        int int0 = (int)(((float)this.x - 4.0F) / 10.0F);
        int int1 = (int)(((float)this.y - 4.0F) / 10.0F);
        int int2 = (int)Math.ceil((double)(((float)this.x + 4.0F) / 10.0F));
        int int3 = (int)Math.ceil((double)(((float)this.y + 4.0F) / 10.0F));

        for (int int4 = int1; int4 < int3; int4++) {
            for (int int5 = int0; int5 < int2; int5++) {
                IsoChunk isoChunk = GameServer.bServer ? ServerMap.instance.getChunk(int5, int4) : IsoWorld.instance.CurrentCell.getChunk(int5, int4);
                if (isoChunk != null) {
                    for (int int6 = 0; int6 < isoChunk.vehicles.size(); int6++) {
                        BaseVehicle baseVehicle = (BaseVehicle)isoChunk.vehicles.get(int6);
                        if (baseVehicle.isIntersectingSquare(this.x, this.y, this.z)) {
                            return baseVehicle;
                        }
                    }
                }
            }
        }

        return null;
    }

    public boolean isVehicleIntersecting() {
        int int0 = (int)(((float)this.x - 4.0F) / 10.0F);
        int int1 = (int)(((float)this.y - 4.0F) / 10.0F);
        int int2 = (int)Math.ceil((double)(((float)this.x + 4.0F) / 10.0F));
        int int3 = (int)Math.ceil((double)(((float)this.y + 4.0F) / 10.0F));

        for (int int4 = int1; int4 < int3; int4++) {
            for (int int5 = int0; int5 < int2; int5++) {
                IsoChunk isoChunk = GameServer.bServer ? ServerMap.instance.getChunk(int5, int4) : IsoWorld.instance.CurrentCell.getChunk(int5, int4);
                if (isoChunk != null) {
                    for (int int6 = 0; int6 < isoChunk.vehicles.size(); int6++) {
                        BaseVehicle baseVehicle = (BaseVehicle)isoChunk.vehicles.get(int6);
                        if (baseVehicle.isIntersectingSquare(this.x, this.y, this.z)) {
                            return true;
                        }
                    }
                }
            }
        }

        return false;
    }

    public IsoCompost getCompost() {
        if (this.getSpecialObjects() != null) {
            for (int _int = 0; _int < this.getSpecialObjects().size(); _int++) {
                if (this.getSpecialObjects().get(_int) instanceof IsoCompost) {
                    return (IsoCompost)this.getSpecialObjects().get(_int);
                }
            }
        }

        return null;
    }

    public void setIsoWorldRegion(IsoWorldRegion mr) {
        this.hasSetIsoWorldRegion = mr != null;
        this.isoWorldRegion = mr;
    }

    public IWorldRegion getIsoWorldRegion() {
        if (GameServer.bServer) {
            return IsoRegions.getIsoWorldRegion(this.x, this.y, this.z);
        } else {
            if (!this.hasSetIsoWorldRegion) {
                this.isoWorldRegion = IsoRegions.getIsoWorldRegion(this.x, this.y, this.z);
                this.hasSetIsoWorldRegion = true;
            }

            return this.isoWorldRegion;
        }
    }

    public void ResetIsoWorldRegion() {
        this.isoWorldRegion = null;
        this.hasSetIsoWorldRegion = false;
    }

    public boolean isInARoom() {
        return this.getRoom() != null || this.getIsoWorldRegion() != null && this.getIsoWorldRegion().isPlayerRoom();
    }

    public int getRoomSize() {
        if (this.getRoom() != null) {
            return this.getRoom().getSquares().size();
        } else {
            return this.getIsoWorldRegion() != null && this.getIsoWorldRegion().isPlayerRoom() ? this.getIsoWorldRegion().getSquareSize() : -1;
        }
    }

    public int getWallType() {
        byte _byte = 0;
        if (this.getProperties().Is(IsoFlagType.WallN)) {
            _byte |= 1;
        }

        if (this.getProperties().Is(IsoFlagType.WallW)) {
            _byte |= 4;
        }

        if (this.getProperties().Is(IsoFlagType.WallNW)) {
            _byte |= 5;
        }

        IsoGridSquare isoGridSquare1 = this.nav[IsoDirections.E.index()];
        if (isoGridSquare1 != null && (isoGridSquare1.getProperties().Is(IsoFlagType.WallW) || isoGridSquare1.getProperties().Is(IsoFlagType.WallNW))) {
            _byte |= 8;
        }

        IsoGridSquare isoGridSquare2 = this.nav[IsoDirections.S.index()];
        if (isoGridSquare2 != null && (isoGridSquare2.getProperties().Is(IsoFlagType.WallN) || isoGridSquare2.getProperties().Is(IsoFlagType.WallNW))) {
            _byte |= 2;
        }

        return _byte;
    }

    public int getPuddlesDir() {
        byte _byte = IsoGridSquare.PuddlesDirection.PUDDLES_DIR_ALL;
        if (this.isInARoom()) {
            return IsoGridSquare.PuddlesDirection.PUDDLES_DIR_NONE;
        } else {
            for (int int0 = 0; int0 < this.getObjects().size(); int0++) {
                IsoObject isoObject = this.getObjects().get(int0);
                if (isoObject.AttachedAnimSprite != null) {
                    for (int int1 = 0; int1 < isoObject.AttachedAnimSprite.size(); int1++) {
                        IsoSprite isoSprite = ((IsoSpriteInstance)isoObject.AttachedAnimSprite.get(int1)).parentSprite;
                        if (isoSprite.name != null) {
                            if (isoSprite.name.equals("street_trafficlines_01_2")
                                || isoSprite.name.equals("street_trafficlines_01_6")
                                || isoSprite.name.equals("street_trafficlines_01_22")
                                || isoSprite.name.equals("street_trafficlines_01_32")) {
                                _byte = IsoGridSquare.PuddlesDirection.PUDDLES_DIR_NW;
                            }

                            if (isoSprite.name.equals("street_trafficlines_01_4")
                                || isoSprite.name.equals("street_trafficlines_01_0")
                                || isoSprite.name.equals("street_trafficlines_01_16")) {
                                _byte = IsoGridSquare.PuddlesDirection.PUDDLES_DIR_NE;
                            }
                        }
                    }
                }
            }

            return _byte;
        }
    }

    public boolean haveFire() {
        int int0 = this.Objects.size();
        IsoObject[] isoObject0 = this.Objects.getElements();

        for (int int1 = 0; int1 < int0; int1++) {
            IsoObject isoObject1 = isoObject0[int1];
            if (isoObject1 instanceof IsoFire) {
                return true;
            }
        }

        return false;
    }

    public IsoBuilding getRoofHideBuilding() {
        return this.roofHideBuilding;
    }

    public IsoGridSquare getAdjacentSquare(IsoDirections dir) {
        return this.nav[dir.index()];
    }

    public IsoGridSquare getAdjacentPathSquare(IsoDirections dir) {
        switch (dir) {
            case NW:
                return this.nw;
            case N:
                return this.n;
            case NE:
                return this.ne;
            case W:
                return this.w;
            case E:
                return this.e;
            case SW:
                return this.sw;
            case S:
                return this.s;
            case SE:
                return this.se;
            default:
                return null;
        }
    }

    public float getApparentZ(float dx, float dy) {
        dx = PZMath.clamp(dx, 0.0F, 1.0F);
        dy = PZMath.clamp(dy, 0.0F, 1.0F);
        if (this.Has(IsoObjectType.stairsTN)) {
            return (float)this.getZ() + PZMath.lerp(0.6666F, 1.0F, 1.0F - dy);
        } else if (this.Has(IsoObjectType.stairsTW)) {
            return (float)this.getZ() + PZMath.lerp(0.6666F, 1.0F, 1.0F - dx);
        } else if (this.Has(IsoObjectType.stairsMN)) {
            return (float)this.getZ() + PZMath.lerp(0.3333F, 0.6666F, 1.0F - dy);
        } else if (this.Has(IsoObjectType.stairsMW)) {
            return (float)this.getZ() + PZMath.lerp(0.3333F, 0.6666F, 1.0F - dx);
        } else if (this.Has(IsoObjectType.stairsBN)) {
            return (float)this.getZ() + PZMath.lerp(0.01F, 0.3333F, 1.0F - dy);
        } else {
            return this.Has(IsoObjectType.stairsBW) ? (float)this.getZ() + PZMath.lerp(0.01F, 0.3333F, 1.0F - dx) : (float)this.getZ();
        }
    }

    public float getTotalWeightOfItemsOnFloor() {
        float _float = 0.0F;

        for (int _int = 0; _int < this.WorldObjects.size(); _int++) {
            InventoryItem inventoryItem = ((IsoWorldInventoryObject)this.WorldObjects.get(_int)).getItem();
            if (inventoryItem != null) {
                _float += inventoryItem.getUnequippedWeight();
            }
        }

        return _float;
    }

    public boolean getCollideMatrix(int dx, int dy, int dz) {
        return getMatrixBit(this.collideMatrix, dx + 1, dy + 1, dz + 1);
    }

    public boolean getPathMatrix(int dx, int dy, int dz) {
        return getMatrixBit(this.pathMatrix, dx + 1, dy + 1, dz + 1);
    }

    public boolean getVisionMatrix(int dx, int dy, int dz) {
        return getMatrixBit(this.visionMatrix, dx + 1, dy + 1, dz + 1);
    }

    public void checkRoomSeen(int playerIndex) {
        IsoRoom isoRoom = this.getRoom();
        if (isoRoom != null && isoRoom.def != null && !isoRoom.def.bExplored) {
            IsoPlayer isoPlayer = IsoPlayer.players[playerIndex];
            if (isoPlayer != null) {
                if (this.z == (int)isoPlayer.z) {
                    byte _byte = 10;
                    if (isoPlayer.getBuilding() == isoRoom.building) {
                        _byte = 50;
                    }

                    if (IsoUtils.DistanceToSquared(isoPlayer.x, isoPlayer.y, (float)this.x + 0.5F, (float)this.y + 0.5F) < (float)(_byte * _byte)) {
                        isoRoom.def.bExplored = true;
                        isoRoom.onSee();
                        isoRoom.seen = 0;
                    }
                }
            }
        }
    }

    public boolean hasFlies() {
        return this.bHasFlies;
    }

    public void setHasFlies(boolean hasFlies) {
        this.bHasFlies = hasFlies;
    }

    public float getLightLevel(int playerIndex) {
        return (this.lighting[playerIndex].lightInfo().r + this.lighting[playerIndex].lightInfo().g + this.lighting[playerIndex].lightInfo().b) / 3.0F;
    }

    public static class CellGetSquare implements IsoGridSquare.GetSquare {
        @Override
        public IsoGridSquare getGridSquare(int x, int y, int z) {
            return IsoWorld.instance.CurrentCell.getGridSquare(x, y, z);
        }
    }

    public static final class CircleStencilShader extends Shader {
        public static final IsoGridSquare.CircleStencilShader instance = new IsoGridSquare.CircleStencilShader();
        public int a_wallShadeColor = -1;

        public CircleStencilShader() {
            super("CircleStencil");
        }

        @Override
        protected void onCompileSuccess(ShaderProgram shaderProgram) {
            this.Start();
            this.a_wallShadeColor = GL20.glGetAttribLocation(this.getID(), "a_wallShadeColor");
            shaderProgram.setSamplerUnit("texture", 0);
            shaderProgram.setSamplerUnit("CutawayStencil", 1);
            this.End();
        }
    }

    public interface GetSquare {
        IsoGridSquare getGridSquare(int x, int y, int z);
    }

    public interface ILighting {
        int lightverts(int i);

        float lampostTotalR();

        float lampostTotalG();

        float lampostTotalB();

        boolean bSeen();

        boolean bCanSee();

        boolean bCouldSee();

        float darkMulti();

        float targetDarkMulti();

        ColorInfo lightInfo();

        void lightverts(int i, int value);

        void lampostTotalR(float r);

        void lampostTotalG(float g);

        void lampostTotalB(float b);

        void bSeen(boolean seen);

        void bCanSee(boolean canSee);

        void bCouldSee(boolean couldSee);

        void darkMulti(float f);

        void targetDarkMulti(float f);

        int resultLightCount();

        IsoGridSquare.ResultLight getResultLight(int index);

        void reset();
    }

    public static final class Lighting implements IsoGridSquare.ILighting {
        private final int[] lightverts = new int[8];
        private float lampostTotalR = 0.0F;
        private float lampostTotalG = 0.0F;
        private float lampostTotalB = 0.0F;
        private boolean bSeen;
        private boolean bCanSee;
        private boolean bCouldSee;
        private float darkMulti;
        private float targetDarkMulti;
        private final ColorInfo lightInfo = new ColorInfo();

        @Override
        public int lightverts(int i) {
            return this.lightverts[i];
        }

        @Override
        public float lampostTotalR() {
            return this.lampostTotalR;
        }

        @Override
        public float lampostTotalG() {
            return this.lampostTotalG;
        }

        @Override
        public float lampostTotalB() {
            return this.lampostTotalB;
        }

        @Override
        public boolean bSeen() {
            return this.bSeen;
        }

        @Override
        public boolean bCanSee() {
            return this.bCanSee;
        }

        @Override
        public boolean bCouldSee() {
            return this.bCouldSee;
        }

        @Override
        public float darkMulti() {
            return this.darkMulti;
        }

        @Override
        public float targetDarkMulti() {
            return this.targetDarkMulti;
        }

        @Override
        public ColorInfo lightInfo() {
            return this.lightInfo;
        }

        @Override
        public void lightverts(int i, int value) {
            this.lightverts[i] = value;
        }

        @Override
        public void lampostTotalR(float r) {
            this.lampostTotalR = r;
        }

        @Override
        public void lampostTotalG(float g) {
            this.lampostTotalG = g;
        }

        @Override
        public void lampostTotalB(float b) {
            this.lampostTotalB = b;
        }

        @Override
        public void bSeen(boolean seen) {
            this.bSeen = seen;
        }

        @Override
        public void bCanSee(boolean canSee) {
            this.bCanSee = canSee;
        }

        @Override
        public void bCouldSee(boolean couldSee) {
            this.bCouldSee = couldSee;
        }

        @Override
        public void darkMulti(float f) {
            this.darkMulti = f;
        }

        @Override
        public void targetDarkMulti(float f) {
            this.targetDarkMulti = f;
        }

        @Override
        public int resultLightCount() {
            return 0;
        }

        @Override
        public IsoGridSquare.ResultLight getResultLight(int index) {
            return null;
        }

        @Override
        public void reset() {
            this.lampostTotalR = 0.0F;
            this.lampostTotalG = 0.0F;
            this.lampostTotalB = 0.0F;
            this.bSeen = false;
            this.bCouldSee = false;
            this.bCanSee = false;
            this.targetDarkMulti = 0.0F;
            this.darkMulti = 0.0F;
            this.lightInfo.r = 0.0F;
            this.lightInfo.g = 0.0F;
            this.lightInfo.b = 0.0F;
            this.lightInfo.a = 1.0F;
        }
    }

    public static final class NoCircleStencilShader {
        public static final IsoGridSquare.NoCircleStencilShader instance = new IsoGridSquare.NoCircleStencilShader();
        private ShaderProgram shaderProgram;
        public int ShaderID = -1;
        public int a_wallShadeColor = -1;

        private void initShader() {
            this.shaderProgram = ShaderProgram.createShaderProgram("NoCircleStencil", false, true);
            if (this.shaderProgram.isCompiled()) {
                this.ShaderID = this.shaderProgram.getShaderID();
                this.a_wallShadeColor = GL20.glGetAttribLocation(this.ShaderID, "a_wallShadeColor");
            }
        }
    }

    public static class PuddlesDirection {
        public static byte PUDDLES_DIR_NONE = 1;
        public static byte PUDDLES_DIR_NE = 2;
        public static byte PUDDLES_DIR_NW = 4;
        public static byte PUDDLES_DIR_ALL = 8;
    }

    private interface RenderWallCallback {
        void invoke(Texture var1, float var2, float var3);
    }

    public static final class ResultLight {
        public int id;
        public int x;
        public int y;
        public int z;
        public int radius;
        public float r;
        public float g;
        public float b;
        public static final int RLF_NONE = 0;
        public static final int RLF_ROOMLIGHT = 1;
        public static final int RLF_TORCH = 2;
        public int flags;

        public IsoGridSquare.ResultLight copyFrom(IsoGridSquare.ResultLight other) {
            this.id = other.id;
            this.x = other.x;
            this.y = other.y;
            this.z = other.z;
            this.radius = other.radius;
            this.r = other.r;
            this.g = other.g;
            this.b = other.b;
            this.flags = other.flags;
            return this;
        }
    }

    private static final class s_performance {
        static final PerformanceProfileProbe renderFloor = new PerformanceProfileProbe("IsoGridSquare.renderFloor", false);
    }
}
